Hi,
> @SequenceGenerator(name = "SeqGen", allocationSize=100,
sequenceName="SEQ")
sequenceName implies the name of the database sequence. And the manual
says: "If you do not specify the database sequence, your vendor will choose
an appropriate default". To tell the vendor (i.e. OpenJPA in this case) to
choose an appropriate default, try
sequenceName="native()" or sequenceName="table()"
This will tell OpenJPA to use its built-in sequences which will be able to
honor allocationSize specified.
graffer wrote:
>
> Hi guys,
>
> My environment: JBOSS 4.2.1, OpenJPA 1.1, Java 5, EJB 3 (+JPA), build time
> enhancement, many entities, Oracle 10g
>
> We are currently inserting a lot of entities. Therefore we use a common
> sequence (inherited from a @MappedSuperClass):
>
> @Id
> @SequenceGenerator(name = "SeqGen", allocationSize = 100, sequenceName =
> "SEQ")
> @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SeqGen")
> public int getId()
> {
> return id;
> }
>
> When creating 1000 entities and then call em.flush(), OpenJPA first
> performs 1000 times
>
> SELECT SEQ.NEXTVAL from dual;
>
> It then executes the 1000 insert statements (hopefully in batch). When
> looking at the allocationSize javadoc, I assumed, that it would create an
> ORACLE sequence with INCREMENT_BY 100 and then catch a new sequence value
> every 100 inserts?
>
> Is my expectation for allocationSize wrong, or do I use it the wrong way?
> Is there a better / other way to configure the expected sequence behavior?
> The problem is that our application now has a huge overhead in performance
> only to calculate the ID of the new entity.
>
> Thank you in advance for your help!
>
> bye, Georg
>
--
View this message in context:
http://n2.nabble.com/Mass-insert--%40SequenceGenerator-allocationSize-ignored--tp363057p363219.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.