[jboss-user] [EJB 3.0] - Re: Attribute from MappedClass as a part of composit PK ?

2009-06-22 Thread Wolfgang Knauf
Hi Dalibor, one more idea, which might prevent you from duplicating the fields: Instead of an EmbeddedId, use an IdClass (annotate the entity with IdClass). This class will have the same fields as the EmbeddedId, but no further annotations. All primary key fields are part of your entity. The

[jboss-user] [EJB 3.0] - Re: Attribute from MappedClass as a part of composit PK ?

2009-06-19 Thread Wolfgang Knauf
Hi, you have to synchronize them yourself. So the setter of one attribute has to update the other. This might be a problem for the embedded id, because it cannot set it's timestamp value to the outer class. But you might add a @PreUpdate callback method to your entity and synchronize both

[jboss-user] [EJB 3.0] - Re: Attribute from MappedClass as a part of composit PK ?

2009-06-17 Thread Wolfgang Knauf
Hi, I am not sure whether the following works, but I would suggest that you use an EmbedddId for your primary key. This way, you have to create an Embeddable class, and you have to duplicate the timestamp ID property to the embeddable class. The only problem with this approach is that this

[jboss-user] [EJB 3.0] - Re: Attribute from MappedClass as a part of composit PK ?

2009-06-17 Thread dkalna
Hi Wolfgang, thanks a lot, I'll try that and let you now if it works. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=4238163#4238163 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=4238163

[jboss-user] [EJB 3.0] - Re: Attribute from MappedClass as a part of composit PK ?

2009-06-17 Thread dkalna
Hi, it works, well at least it deploys. But how to make sure those two attributes are in sync? Any ideas? View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=4238189#4238189 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=4238189