[jboss-user] [EJB/JBoss] - Re: persist entity ignores the
sfisque
do-not-reply at jboss.com
Thu Jul 10 18:21:11 EDT 2008
posting this so that anyone else searching on this will find what i found:
if you have an object with a composite key object, e.g:
| @Entity
| @IdClass( ThingPK.class )
| @Table( name="Thing" )
| public class Thing
| implements Serializable
| {
| @Id
| private String keyOne;
|
| @Id
| private String keyTwo;
|
| @Column( name="value_one" )
| private String valueOne;
|
| // getter/setters omitted for brevity
| }
|
| public class ThingPK
| implements Serializable
| {
| @Column( name="key_one" )
| private String keyOne;
|
| @Column( name="key_two" )
| private String keyTwo;
|
| // getter/setters omitted for brevity
| }
|
what ended up causing the above problem is that i had annotated the @Columns in the entity object (Thing), instead of instrumenting the PK class (ThingPK), once i corrected it (to appear like the above), the column name was properly injected and it worked fine. all of the example code i've seen never indicates that the @Column instrumentation is supposed to go into the PK class and not the entity class.
caveat emptor.
== stanton
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163724#4163724
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163724
More information about the jboss-user
mailing list