-->
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: why transaction is required
PostPosted: Fri Feb 23, 2007 1:56 am 
Newbie

Joined: Mon Feb 19, 2007 1:44 am
Posts: 8
Hi All,


I want to know one thing about hibernate.
while inserting some records in database using hibernate in a Java program, why transaction is required?? is it mandatory we need to use transaction? if so why?

Another question that I have is
is there any way we can store the hibernate query result value in a object(of the class which we are persisting) and dispaly it with getter methods, if we are querying only a few fields of the table..not all

Thanks and Regards,
Jacob


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 23, 2007 5:31 am 
Beginner
Beginner

Joined: Tue Dec 12, 2006 6:43 am
Posts: 32
Location: London
Transaction is required by Hiberante since the underlyer which is the JDBC context which establish the connection to the database (JDBC driver) work in a transactional way when you hook up with the tables; so Hibernate session is a representation of an open JDBC connection in some part of it.

You can save the query result based on a selected columns which returns a List<Object[]> into a holder class or a EhCacher which has no transactional caching aspect or you can you the JBossCache
at www.jboss.org/products/jbosscache

The cacher allows you to cache the result into a file system if you want to persist them or into the memory.

Regards,
Alan Mehio
London, UK

_________________
Alan Mehio
London
UK


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.