-->
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: Hibernate and JAX-WS - How to disconnect an object + child?
PostPosted: Thu Jun 24, 2010 2:23 am 
Newbie

Joined: Tue Apr 27, 2010 5:18 pm
Posts: 19
Hi

I'm using a combination of JAX-WS and Hibernate.
It works quite well,but I can't quite handle the session correctly.

The problem is, if I close the session, before I exit the WebService method, as I should,
Hibernate throws an Exception when JAX-WS tries to serialize the Object + its children.
The object has been read from the database, but the child/children are still in the Hibernate buffer/Database.
Therefore by closing the associated session, I take away any chance JAX-WS has to serialize the objects.
How does one go about solving this problem?

Code:
@WebMethod
    public Collection<Something> getSomething () throws Exception
    {
        //The Hibernate Session gives the object without changes.
        Session session = getSession();
        Query query = session.createQuery("from Something");
        Collection <Something> collectionWithChildren = (Collection<Something>)query.list();

        session.close
        return collectionWithChildren;//throws an Exception when serializing children.
    }


Thanks in advance for you suggestions.


Top
 Profile  
 
 Post subject: Re: Hibernate and JAX-WS - How to disconnect an object + child?
PostPosted: Thu Jun 09, 2011 1:30 pm 
Newbie

Joined: Tue Apr 27, 2010 5:18 pm
Posts: 19
solved.

Make as @XmlTransient and JAX will not serialise the children


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.