Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

@VersionColumns usage

Dinkar Rao

2008-08-20

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi,

The OpenJPA manual very briefly talks about the @VersionColumns annotation,
but its usage is not clear. I have an entity that tries to use this
annotation (below), but I get back an exception when I run the mapping tool
against it:

"Exception in thread "main" <openjpa-1.3.0-SNAPSHOT-runknown fatal user
error>
org.apache.openjpa.util.MetaDataException: For "entities.Employee<version>",
expected 1 column(s),
but found 2."

1. What is the correct usage for @VersionColumns ?
2. Is it to be used when the underlying database supports multiple surrogate
version columns for the same table ? Or...
3. ...is it to be used in conjunction with secondary tables, where the
primary and each secondary table have their own database-generated surrogate
version column ? In the snippet below, it doesn't matter whether I have the
@SecondaryTable annotation or not - I get the exception from the mapping
tool anyway.

Thanks,
Dinkar

@Entity
@VersionColumns({@VersionColumn(name="vcol1"),@(protected)")})
@SecondaryTable(name="EADDRESS",
pkJoinColumns=@(protected)"))
public class Employee {
 @Id @GeneratedValue(strategy=GenerationType.AUTO)
 private int empid;
 private String name;
 
 @Column(table="EADDRESS")
 private String street1;
 @Column(table="EADDRESS")
 private String street2;
 @Column(table="EADDRESS")
 private String city;
 @Column(table="EADDRESS")
 private int zipcode;
}
--
Sent from the OpenJPA Users mailing list archive at Nabble.com.

©2008 gg3721.com - Jax Systems, LLC, U.S.A.