Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Dynamic: how to configure generated id using API?(dynamic generated id)
icon5.gif  Dynamic: how to configure generated id using API? [message #1243617] Tue, 11 February 2014 07:54 Go to next message
yuan yao is currently offline yuan yaoFriend
Messages: 6
Registered: February 2014
Junior Member
With XML, we could generate id using IDENTITY

<id name="id" attribute-type="Integer">
<column name="id" />
<generated-value strategy="IDENTITY" />
</id>

How could we achieve this using Dynamic API?

JPADynamicTypeBuilder typeBuilder = dynamicTypeBuilders.get(entityMeta.getName());
...
typeBuilder.setPrimaryKeyFields(pkColumn);
NativeSequence seq = new NativeSequence();
seq.setShouldAcquireValueAfterInsert(true); // not working

Thanks!
Re: Dynamic: how to configure generated id using API? [message #1248340 is a reply to message #1243617] Mon, 17 February 2014 06:36 Go to previous message
yuan yao is currently offline yuan yaoFriend
Messages: 6
Registered: February 2014
Junior Member
Did I clearly show my situations?

I just want to specify the id of the entity using dynamic API of EclipseLink JPA. And I want to specify the generated-value strategy of it. For Mysql, I intend to use auto-increment(IDENTITY strategy). Using annotations/XML, we could do it easily. But how to do with dynamic API?
Previous Topic:Attributes in the default namespace?
Next Topic:JDBC bind parameters only for one of them
Goto Forum:
  


Current Time: Fri Dec 19 06:45:08 GMT 2014

Powered by FUDForum. Page generated in 0.06453 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software