openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dinkar Rao <dinkar.d91411...@gmail.com>
Subject @VersionColumns usage
Date Wed, 20 Aug 2008 18:36:52 GMT

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"),@VersionColumn(name="vcol2")})
@SecondaryTable(name="EADDRESS",
pkJoinColumns=@PrimaryKeyJoinColumn(name="EMPID"))
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;
}
-- 
View this message in context: http://n2.nabble.com/%40VersionColumns-usage-tp736463p736463.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message