Fetched by fetch-profile results are lost outside of the session
----------------------------------------------------------------
Key: HHH-5107
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5107
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Final
Environment: [junit] 0 [main] INFO org.hibernate.cfg.Environment - Hibernate
3.5.0-Final
[junit] 0 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
[junit] 16 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name :
javassist
[junit] 16 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4
java.sql.Timestamp handling
[junit] 78 [main] INFO org.hibernate.cfg.Configuration - configuring from url:
file:/C:/Elif/Develop/ConFRM-Server/config/hibernate.hsqldb-cfg.xml
[junit] 125 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from
resource : hibernate-mappings/Authentication.hbm.xml
[junit] 203 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class:
gov.nasa.arc.confrm.authentication.User -> CONFRM_USER
[junit] 219 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection:
gov.nasa.arc.confrm.authentication.User.roles -> CONFRM_USER_ROLES
[junit] 219 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class:
gov.nasa.arc.confrm.authentication.UserRole -> USER_ROLE
[junit] 219 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from
resource : hibernate-mappings/Constraint.hbm.xml
[junit] 234 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class:
gov.nasa.arc.confrm.constraint.ConstraintType -> CONSTRAINT_TYPE
[junit] 234 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class:
gov.nasa.arc.confrm.constraint.ConstraintStatus -> CONSTRAINT_STATUS
[junit] 250 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class:
gov.nasa.arc.confrm.constraint.Constraint -> CONSTRAINT
[junit] 344 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class:
gov.nasa.arc.confrm.constraint.SourceRecord -> SOURCE_RECORD
[junit] 344 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class:
gov.nasa.arc.confrm.constraint.CommentThread -> COMMENT_THREAD
[junit] 344 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class:
gov.nasa.arc.confrm.constraint.Comment -> COMMENT
[junit] 344 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory:
null
[junit] 344 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection:
gov.nasa.arc.confrm.constraint.Constraint.commentThreads -> COMMENT_THREAD
[junit] 344 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection:
gov.nasa.arc.confrm.constraint.CommentThread.comments -> COMMENT
[junit] 344 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection:
gov.nasa.arc.confrm.constraint.Comment.responses -> COMMENT
[junit] 1266 INFO [main] org.springframework.orm.hibernate3.LocalSessionFactoryBean -
Building new Hibernate SessionFactory
[junit] 344 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider -
Using Hibernate built-in connection pool (not for production use!)
[junit] 344 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider -
Hibernate connection pool size: 1
[junit] 344 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider -
autocommit mode: false
[junit] 344 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider -
using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql://localhost/confrm
[junit] 344 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider -
connection properties: {user=sa, password=****}
[junit] 375 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: HSQL Database
Engine, version: 1.8.0
[junit] 375 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: HSQL Database
Engine Driver, version: 1.8.0
[junit] 391 [main] INFO org.hibernate.dialect.Dialect - Using dialect:
org.hibernate.dialect.HSQLDialect
[junit] 406 [main] INFO org.hibernate.engine.jdbc.JdbcSupportLoader - Disabling
contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
[junit] 406 [main] INFO org.hibernate.transaction.TransactionFactoryFactory -
Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
[junit] 406 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No
TransactionManagerLookup configured (in JTA environment, use of read-write or
transactional second-level cache is not recommended)
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during
beforeCompletion(): disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at
end of transaction: disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for
versioned data: disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets:
enabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys():
disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode:
auto
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size:
1
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with
comments: disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by
primary key: disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for
batching: disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator:
org.hibernate.hql.ast.ASTQueryTranslatorFactory
[junit] 406 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using
ASTQueryTranslatorFactory
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Query language
substitutions: {}
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance:
disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache:
enabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory :
org.hibernate.cache.impl.NoCachingRegionFactory
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal
puts: disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level
cache entries: disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic
identifier rollback: disabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Named query checking :
enabled
[junit] 406 [main] INFO org.hibernate.cfg.SettingsFactory - Check Nullability in Core
(should be disabled when Bean Validation is on): enabled
[junit] 438 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session
factory
[junit] > orderByFragment(order-by)
[junit] > sortSpecification({sort specification})
[junit] > sortKeySpecification(sort key)
[junit] > sortKey($PlaceHolder$.addedOn)
[junit] < sortKey(null)
[junit] < sortKeySpecification(null)
[junit] < sortSpecification(null)
[junit] < orderByFragment(null)
[junit] > orderByFragment(order-by)
[junit] > sortSpecification({sort specification})
[junit] > sortKeySpecification(sort key)
[junit] > sortKey($PlaceHolder$.addedOn)
[junit] < sortKey(null)
[junit] < sortKeySpecification(null)
[junit] < sortSpecification(null)
[junit] < orderByFragment(null)
[junit] > orderByFragment(order-by)
[junit] > sortSpecification({sort specification})
[junit] > sortKeySpecification(sort key)
[junit] > sortKey($PlaceHolder$.addedOn)
[junit] < sortKey(null)
[junit] < sortKeySpecification(null)
[junit] < sortSpecification(null)
[junit] < orderByFragment(null)
[junit] 625 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding
factory to JNDI, no JNDI name configured
[junit] 2063 INFO [main] org.springframework.jdbc.datasource.DriverManagerDataSource
- Loaded JDBC driver: org.hsqldb.jdbcDriver
[junit] 2110 INFO [main]
org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor -
Validated configuration attributes
[junit] 2141 INFO [main]
org.springframework.security.provisioning.JdbcUserDetailsManager - No authentication
manager set. Reauthentication of users when changing passwords will not be performed.
[junit] 1266 [main] INFO org.hibernate.validator.util.Version - Hibernate Validator
4.0.2.GA
Reporter: Elif Kurklu
Created a fetch-profile on a lazy collection, and used it in server code. I can see the
SQL statement running with proper join to load the collection objects. Yet, when I try to
access the collection outside the session, I still get LazyInitializationException.
The data is fetched already, why is it dropped in favor of lazy loading?
I thought this was a great alternative to using Hibernate.initialize(). I would love it
to work that way!
code with fetch profile:
public T load(PK id, String fetchProfile) {
Session s = getSession();
s.enableFetchProfile(fetchProfile);
T o = (T) s.load(type, id);
return o;
}
mapping file:
<class name="Constraint" table="CONSTRAINT">
<id name="id" type="int" access="field"><generator
class="native"/></id>
<property name="number" type="string"
not-null="true"/>
<property name="name" type="string" not-null="true"/>
<property name="versionName" type="string"
not-null="true"/>
<set name="commentThreads" inverse="true"
order-by="addedOn" lazy="true" cascade="all,delete-orphan"
access="field">
<key column="constraint_id"/>
<one-to-many class="CommentThread"/>
</set>
<fetch-profile name="constraint-fetch">
<fetch association="commentThreads" style="join"/>
</fetch-profile>
</class>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira