-->
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.  [ 8 posts ] 
Author Message
 Post subject: Problem with CGLIB reflection optimizer(2.1.1 - 17.12.2003)
PostPosted: Wed Dec 31, 2003 10:55 am 
Newbie

Joined: Wed Nov 12, 2003 11:07 am
Posts: 15
Location: Canada
Hi,
I am having problem with Hibernate 2.1.1 when I set the lazy instantiation to false in a one-to-many relationship. It can not initialize collection. It is working when I use Hibernate 2.0.3
Here is part of my mapping for Account object:
<set
name="investorAccounts"
lazy="false"
inverse="true"
cascade="delete"
>
<key>
<column name="account_id" />
</key>
<one-to-many
class="InvestorAccount"
/>
</set>
I am using the latest release of Hibernate 2.1.1 - 17.12.2003
I believe this is a bug with 2.1.1 Please advise.
Thanks,
-Kourosh


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 31, 2003 11:13 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
http://www.hibernate.org/74.html#A4

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 31, 2003 11:47 am 
Newbie

Joined: Wed Nov 12, 2003 11:07 am
Posts: 15
Location: Canada
epbernard wrote:


I am using new jar the one shipped with hibernate2 (./lib/cglib2.jar). I also took out the old cglib-asm.jar. The problem happens if I don't use
lazy initialization.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 31, 2003 11:53 am 
Newbie

Joined: Wed Nov 12, 2003 11:07 am
Posts: 15
Location: Canada
epbernard wrote:


Here is the error:

(util.JDBCExceptionReporter 38 ) could not initialize collection: [Account.investorAccounts#6]
java.sql.SQLException: No data found
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataDouble(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataDouble(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getLong(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getLong(Unknown Source)
at net.sf.hibernate.type.LongType.get(LongType.java:18)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.type.ManyToOneType.hydrate(ManyToOneType.java:61)
at net.sf.hibernate.type.ComponentType.hydrate(ComponentType.java:371)
at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:145)
at net.sf.hibernate.type.ManyToOneType.hydrate(ManyToOneType.java:61)
at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:154)
at net.sf.hibernate.collection.AbstractCollectionPersister.readElement(AbstractCollectionPersister.java:363)
at net.sf.hibernate.collection.Set.readFrom(Set.java:235)
at net.sf.hibernate.loader.Loader.readCollectionElement(Loader.java:304)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:218)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:132)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:909)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:884)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:80)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3133)
at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:331)
at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3007)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:137)
at net.sf.hibernate.loader.Loader.doList(Loader.java:949)
at net.sf.hibernate.loader.Loader.list(Loader.java:940)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:833)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1475)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at BaseDAO.findb(BaseDAO.java:243)
at SessionDbDAO.find(SessionDbDAO.java:39)
at AccountDAO.getInvestorAccounts(AccountDAO.java:91)
at AccountDAO.main(AccountDAO.java:293)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 03, 2004 3:11 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
Remove all jars from the prior Hibernate version - not just the old cglib-asm. Make sure you are using only the jars from the the new distribution.


Also, check out this thread http://forum.hibernate.org/viewtopic.php?t=926655 It looks like you are not in an app server, but the issues with what is in the classpath are relevant.


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2004 5:19 pm 
Newbie

Joined: Wed Nov 12, 2003 11:07 am
Posts: 15
Location: Canada
sgwood wrote:
Remove all jars from the prior Hibernate version - not just the old cglib-asm. Make sure you are using only the jars from the the new distribution.


Also, check out this thread http://forum.hibernate.org/viewtopic.php?t=926655 It looks like you are not in an app server, but the issues with what is in the classpath are relevant.


Sherman


I am using jdbc-odbc bridge. A default ResultSet object is not updatable and has a cursor that moves forward only. Thus, you can iterate through it only once and only from the first row to the last row. In hibernate 2.1.1
if we read the same name twice from the result set we run into the problem that I am having now. Because I am using dialect, it will cause Hibernate to use a sensible default. Even though I changed my dialect still I had to change method doQuery in class: net.sf.hibernate.loader

final PreparedStatement st = prepareQueryStatement(
applyLocks( getSQLString(), queryParameters.getLockModes(), session.getFactory().getDialect() ),
queryParameters, true, session
);


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2004 5:31 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
I don't really follow you, but I assume you are saying that you have come across a bug in Hibernate. Post the details in JIRA.

Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2004 6:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This has come up in various threads allready, and has been answered multiple times: Hibernate will not be modified to take care of such low-quality JDBC drivers. Compare to thread http://forum.hibernate.org/viewtopic.php?t=926686 and HB-484


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.