openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Mapping a collection of entities...
Date Wed, 19 Nov 2008 01:36:39 GMT
Hello all,

I'm trying to teach myself OpenJPA and failing miserably...  I have two entities (code below)
where one contains a collection of the other.  The intent is for UserInfo to be able to contain
a collection (or List) of an arbitrary number of UserProperties.  The UserProperties are defined
at run-time by data entered through the application.

With it defined as follows in the ear file deploys fine in Geronimo, but calling any of the
service methods that try to query or insert data result in the following errors:
javax.ejb.EJBException: The bean encountered a non-application exception.; nested exception
	<openjpa-1.0.2-r420667:627158 fatal user error> org.apache.openjpa.persistence.ArgumentException:
You have supplied columns for "", but this
mapping cannot have columns in this context.

The relevant portion of the entities are defined as:
public class UserInfo implements Serializable {

	@Column(name="id", nullable=false, insertable=false, updatable=false)
	private Integer id;
	@OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	@JoinColumn(name="prop_id", referencedColumnName="userId")
	private Collection<UserProperties> userProperties;

public class UserProperties implements Serializable {

	@Column(name="id", nullable=false)
	private Integer id;
	@JoinColumn(name="user_id", referencedColumnName="id")
	private UserInfo userInfo;
I thought I had it right according to the documentation and the few examples I've seen, but
I've got something wrong.  Any help getting this solved would be greatly appreciated.


View raw message