You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by agumbrecht <ag...@tomitribe.com> on 2014/07/06 15:09:01 UTC
Re: Hibernate IdentifierGenerator
Hi Herau,
Try this as a generic solution:
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid")
@Column(name = "id", unique = true)
private String id;
I'm not so sure that OpenJPA supports custom generators out of the box, so I
will need to look into that.
You can still use Hibernate in TomEE, so no need to change your app if you
want to stick with Hibernate.
See the example here: http://openejb.apache.org/examples/jpa-hibernate/
Andy.
-----
--
Andy Gumbrecht
http://www.tomitribe.com
agumbrecht@tomitribe.com
https://twitter.com/AndyGeeDe
TomEE treibt Tomitribe ! | http://tomee.apache.org
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Hibernate-IdentifierGenerator-tp4670255p4670336.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Hibernate IdentifierGenerator
Posted by herau <le...@gmail.com>.
Thanks guys. I will try your solution
Le 6 juil. 2014 17:17, "Romain Manni-Bucau [via TomEE & OpenEJB]" <
ml-node+s979440n4670339h30@n4.nabble.com> a écrit :
> Hi
>
> just guessing but openjpa uuid strategy can match your need:
>
> http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_meta_gen
>
> in all cases you can define your own Generator
>
> http://ci.apache.org/projects/openjpa/trunk/javadoc/org/apache/openjpa/persistence/Generator.html
>
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-07-06 15:09 GMT+02:00 agumbrecht <[hidden email]
> <http://user/SendEmail.jtp?type=node&node=4670339&i=0>>:
>
> > Hi Herau,
> >
> > Try this as a generic solution:
> >
> > @Id
> > @GeneratedValue(generator = "uuid")
> > @GenericGenerator(name = "uuid", strategy = "uuid")
> > @Column(name = "id", unique = true)
> > private String id;
> >
> > I'm not so sure that OpenJPA supports custom generators out of the box,
> so I
> > will need to look into that.
> >
> > You can still use Hibernate in TomEE, so no need to change your app if
> you
> > want to stick with Hibernate.
> >
> > See the example here: http://openejb.apache.org/examples/jpa-hibernate/
> >
> > Andy.
> >
> >
> >
> >
> > -----
> > --
> > Andy Gumbrecht
> >
> > http://www.tomitribe.com
> > [hidden email]
> <http://user/SendEmail.jtp?type=node&node=4670339&i=1>
> > https://twitter.com/AndyGeeDe
> >
> > TomEE treibt Tomitribe ! | http://tomee.apache.org
> > --
> > View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Hibernate-IdentifierGenerator-tp4670255p4670336.html
> > Sent from the TomEE Users mailing list archive at Nabble.com.
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://tomee-openejb.979440.n4.nabble.com/Hibernate-IdentifierGenerator-tp4670255p4670339.html
> To unsubscribe from Hibernate IdentifierGenerator, click here
> <http://tomee-openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4670255&code=bGVib3VsYW5nZXIuYXVyZWxpZW5AZ21haWwuY29tfDQ2NzAyNTV8LTgzNDU4MTk5MA==>
> .
> NAML
> <http://tomee-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>
>
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Hibernate-IdentifierGenerator-tp4670255p4670340.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Hibernate IdentifierGenerator
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi
just guessing but openjpa uuid strategy can match your need:
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_meta_gen
in all cases you can define your own Generator
http://ci.apache.org/projects/openjpa/trunk/javadoc/org/apache/openjpa/persistence/Generator.html
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau
2014-07-06 15:09 GMT+02:00 agumbrecht <ag...@tomitribe.com>:
> Hi Herau,
>
> Try this as a generic solution:
>
> @Id
> @GeneratedValue(generator = "uuid")
> @GenericGenerator(name = "uuid", strategy = "uuid")
> @Column(name = "id", unique = true)
> private String id;
>
> I'm not so sure that OpenJPA supports custom generators out of the box, so I
> will need to look into that.
>
> You can still use Hibernate in TomEE, so no need to change your app if you
> want to stick with Hibernate.
>
> See the example here: http://openejb.apache.org/examples/jpa-hibernate/
>
> Andy.
>
>
>
>
> -----
> --
> Andy Gumbrecht
>
> http://www.tomitribe.com
> agumbrecht@tomitribe.com
> https://twitter.com/AndyGeeDe
>
> TomEE treibt Tomitribe ! | http://tomee.apache.org
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Hibernate-IdentifierGenerator-tp4670255p4670336.html
> Sent from the TomEE Users mailing list archive at Nabble.com.