-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Downside to accessing identity generator directly for JDBC ?
PostPosted: Mon May 05, 2008 11:44 am 
Newbie

Joined: Thu Mar 27, 2008 10:50 am
Posts: 13
Is there any downside to using identity generator directly using code such as...
Code:
EntityManager em = ...;
HibernateEntityManager hibEM = (HibernateEntityManager) em;
Session session = hibEM.getSession();
SessionFactoryImpl sessionFactoryImpl = (SessionFactoryImpl) session.getSessionFactory();
IdentifierGenerator identifierGenerator = sessionFactoryImpl.getIdentifierGenerator("com.company.business.aim.instance.Instance");
long hibernateId = ((Number) identifierGenerator.generate((SessionImplementor) session, null)).longValue();


For certain functionality in our application, an extremely large number (in the millions or 10s of millions) of entities are going to be generated. Benchmarking a pure JDBC approach versus JPA/Hibernate based approach shows the JDBC approach to be clearly the winner by a factor of 10 times faster than the JPA/Hibernate approach. However, in using pure JDBC for these millions of inserts, we would still like to use the identity generator that is configured via annotations, to generate the primary key values.

FWIW, the application is being designed to use JPA API and not Hibernate directly in most other areas.

Any pointers to concerns we should look out for will be highly appreciated.
Thanks in advance.


Top
 Profile  
 
 Post subject: Any thoughts?
PostPosted: Wed May 14, 2008 8:43 am 
Newbie

Joined: Thu Mar 27, 2008 10:50 am
Posts: 13
It would be great if an expert could respond.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.