Thanks On Sat, Jan 19, 2013 at 7:51 AM, Romain Manni-Bucau [via OpenEJB] < [email protected]> wrote:
> Hi, > > You should fwd this question to openjpa list IMO and try to create a > runnable sample instead of pasting the code in a mail (otherwise you'll > need to wait people do it themselves...) > Le 19 janv. 2013 00:12, "avrono" <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4660309&i=0>> > a écrit : > > > The main issue is with the generated ID`s - I cannot get a > unidirectional > > OneToOne relationship working where the id columns of the two tables is > > identical. If I remove the @GeneratedValue annotation from the child > table > > I > > can get the persistence to work but with differing id fields. I am using > > MySQL with Primary Key (Auto Increment) on the id fields ... > > > > Does anyone have any ideas ? > > > > In the User class > > > > @Entity > > @Table(name="user") > > //@SequenceGenerator(name = "CUSTOMER_SEQUENCE", sequenceName = > > "CUSTOMER_SEQUENCE", allocationSize = 1, initialValue = 0) > > public class User implements Serializable { > > private static final long serialVersionUID = 1L; > > > > @Id > > @GeneratedValue(strategy=GenerationType.IDENTITY) > > private int id; > > > > @OneToOne(cascade={CascadeType.ALL}) > > @PrimaryKeyJoinColumn(name="id", referencedColumnName="id") > > //@JoinColumn(name="id", referencedColumnName = "id") > > private Usergroup usergroup; > > > > > > In the usergroup > > > > @Table(name="usergroup") > > public class Usergroup implements Serializable { > > private static final long serialVersionUID = 1L; > > > > @Id > > // @GeneratedValue(strategy=GenerationType.IDENTITY) > > private int id; > > > > > > ...... > > > > > > > > -- > > View this message in context: > > > http://openejb.979440.n4.nabble.com/Persistence-assistence-PrimaryKeyJoinColumn-tp4660307p4660308.html > > Sent from the OpenEJB User mailing list archive at Nabble.com. > > > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://openejb.979440.n4.nabble.com/Persistence-assistence-PrimaryKeyJoinColumn-tp4660307p4660309.html > To unsubscribe from Persistence assistence @PrimaryKeyJoinColumn, click > here<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4660307&code=YXZyb25AbmV1cmFsbS5jb218NDY2MDMwN3wtODgzNTcwOTQ1> > . > NAML<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- *Avron Olshewsky* *Director* Tel : +44 207 1837733 Mob: +44 7508 407 065 Twitter: @NeuralM / @avrono Skype: avrono http://www.neuralm.com -- View this message in context: http://openejb.979440.n4.nabble.com/Persistence-assistence-PrimaryKeyJoinColumn-tp4660307p4660310.html Sent from the OpenEJB User mailing list archive at Nabble.com.
