-->
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: StatelessSession support for Embedded objects?
PostPosted: Mon Oct 25, 2010 7:13 pm 
Beginner
Beginner

Joined: Tue Mar 17, 2009 12:19 pm
Posts: 22
Using Hibernate 3.5.6 Final. I have a class marked @Embeddable and an entity class with a reference to the former with:

Code:
    @ElementCollection
    @JoinTable(name = "EmbeddedTable", joinColumns = @JoinColumn(name = "columnid"))
    public Set<EmbeddedObject> getEmbeddedObjects() {
        return _embeddedObjects;
    }


Functions just fine when using StatefulSession but StatelessSession does not persist the embedded object when calling insert() on the containing entity. Since you can't pass an embedded object to persist, how can you use StatelessSession with embedded objects?

Thanks!


Top
 Profile  
 
 Post subject: Re: StatelessSession support for Embedded objects?
PostPosted: Tue Oct 26, 2010 2:49 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
A stateless session has several differences from a regular session. This is from the javadoc: http://docs.jboss.org/hibernate/stable/ ... ssion.html

Quote:
A stateless session does not implement a first-level cache nor interact with any second-level cache, nor does it implement transactional write-behind or automatic dirty checking, nor do operations cascade to associated instances. Collections are ignored by a stateless session. Operations performed via a stateless session bypass Hibernate's event model and interceptors. Stateless sessions are vulnerable to data aliasing effects, due to the lack of a first-level cache.


I guess this means that you need to use a regular session.


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.