-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate transaction size
PostPosted: Tue Jan 31, 2006 10:14 am 
Newbie

Joined: Thu Jan 26, 2006 2:45 pm
Posts: 5
Thank you all for your answers. Currently, I don't have enough time to implement the solution that you suggest, that is: implement some Session bean methods that have some properties initialized and others don't. For example:

I) User getSkeletonUser(String login) {
..
Query q = session.createQuery("from User login=?");
q.setString(0, login);
return (User) q.uniqueResult();
}

II) User getCompleteUser(String login) {
..
Query q = session.createQuery("from User login=?");
q.setString(0, login);
User u = (User) q.uniqueResult();

//initialize related data
u.getUserRoles();
..

return (User)q.uniqueResult();

}


At the moment, I had the first approach implemented with lazy="false". In such a way the hole object where retrieved, but it implies a very poor performance.

The other alternative that I am evaluating is don't use Session Beans so the methods above were implemented in the same way as the first approach but in a plain java object (using the session-per-request) pattern that enables the use of lazy feature of Hibernate.

Then again, I'm having some troubles, I set all the object with the lazy flag, so they would be retrieved only when they are needed. But I think there is a maximum size of the transaction handled, because I get an error (own Session was closed) while a i am iterating over a collection of Hibernate proxy objects. The strange thing is that I obtained the error in the n"th" iteration, that means, i think, that there is some transaction size problem...I don't know if i am right about this..

Thank you soy much for ANY help.

Marcelo

_________________
Computer Engineering Marcelo Giorgi.


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

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.