-->
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: deleting secondary object after query execution.
PostPosted: Thu Aug 11, 2005 8:50 am 
Newbie

Joined: Wed Dec 08, 2004 1:49 am
Posts: 4
I am facing very strange problem.

My Search Command is in transaction context,
The search result has one to many relation ships
Like User ----> UserPermission
Hibernate get all Users and its Permission,
Immediately it clears the Permissions for the user
Since this is in transaction context,
It also removes the permission from table.

Please help me to understand this problem and resolve it.
why hibernate clear the permission after it fetch.

Environment.
Hibernate 2.8.1
Jboos 32.6
JDK 1.5

Java code
public class SearchUserCommand extends SearchCommand
{
private List<User> userList = null;
private static Object cat =
SawMill.addCategory(SearchUserCommand.class.getName());


protected void doExec(Session session) throws AccessException
{
SawMill.debug(cat,"Inside doExec() of SearchUserCommand");
Criteria queryCriteria = session.createCriteria(User.class);
Criterion expression = null;
Order newOrder = null;
for(Iterator<Criterion> i = filter.iterator(); i.hasNext(); )
{
expression = i.next();
queryCriteria.add(expression);
}
for(Iterator<Order> i = order.iterator(); i.hasNext(); )
{
newOrder = i.next();
queryCriteria.addOrder(newOrder);
}

try
{
userList = queryCriteria.list();
}
catch(HibernateException ex)
{
SawMill.error(cat,"Can't search user Info : "+ex.getMessage());
throw new AccessException("Error while searching user Info",ex);
}
}

public List<User> getUserList()
{
return userList;
}
}


Top
 Profile  
 
 Post subject: Re: deleting secondary object after query execution.
PostPosted: Thu Aug 11, 2005 9:02 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
There's no reason for Hiberante to load the collection and then clear it out. I would use a debugger and step through the code to figure out where it is being reset.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


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.