-->
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.  [ 11 posts ] 
Author Message
 Post subject: session.find() can't see newly added objects
PostPosted: Tue Dec 02, 2003 9:12 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 6:15 am
Posts: 22
Hi all

Suppose I have a table TEMP with column A being the PK and b and c are attributes, so:

TEMP(A, b, c)

and I have a corresponding object Temp.java mapped to this table. PK column A has an Oracle sequence and Hibernate is mapped to know this. It all works in Hibernate.

If I do:

Temp t = new Temp()
t.setB("b");
t.setC("c");
Serializable id = session.save(t);
Temp t2 = (Temp)session.load(Temp.class, id);

Hibernate issues no SELECT statement but I can get t2. In other words, Hibernate returns the cached copy of Temp to me and that is good.

However, if I do:
Temp t = new Temp()
t.setB("b");
t.setC("c");
List list = session.find("from Temp as t where t.b='b'");
for (int i = 0; i < list.size(); i++) {
Temp t2 = (Temp)list.get(i);
System.out.println(t2.getC());
}

Hibernate issues a SELECT statement but then I cannot find any matching record. The loop is not run. I tried session.flush() and session.connection().commit() but they don't help.

Did I miss something or is that a bug?

Thanks & regards
Kevin


Top
 Profile  
 
 Post subject: Re: session.find() can't see newly added objects
PostPosted: Tue Dec 02, 2003 9:51 pm 
Newbie

Joined: Tue Nov 25, 2003 5:05 pm
Posts: 18
Please try:
Code:
Temp t = new Temp()
t.setB("b");
t.setC("c");
session.save(t);
session.flush();
session.connection().commit();

Session session2 = SessionFactory.openSession();
List list = session2.find("from Temp as t where t.b='b'");
for (int i = 0; i < list.size(); i++) {
  Temp t2 = (Temp)list.get(i);
  System.out.println(t2.getC());
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 9:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
Did I miss something or is that a bug?


Yes, you missed something, and yes, it is a bug in your code. You don't save() the object. Use:

Code:
Temp t = new Temp()
t.setB("b");
t.setC("c");
session.save(t); //<---HERE
List list = session.find("from Temp as t where t.b='b'");
for (int i = 0; i < list.size(); i++) {
   Temp t2 = (Temp)list.get(i);
   System.out.println(t2.getC());
}


You do not need to do anything special to see changes


Top
 Profile  
 
 Post subject: Re: session.find() can't see newly added objects
PostPosted: Tue Dec 02, 2003 10:10 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 6:15 am
Posts: 22
Sven! wrote:
Please try:
Code:
Session session2 = SessionFactory.openSession();
List list = session2.find("from Temp as t where t.b='b'");
for (int i = 0; i < list.size(); i++) {
  Temp t2 = (Temp)list.get(i);
  System.out.println(t2.getC());
}


Hi Sven

But if I use a different session, I will lose previously cached objects. Actually, The object is much more complicated than that. It has lots of associated tables and therefore it's critical for me to cache as many objects as possible.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 10:12 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 6:15 am
Posts: 22
gavin wrote:
Quote:
Did I miss something or is that a bug?


Yes, you missed something, and yes, it is a bug in your code. You don't save() the object. Use:

Code:
Temp t = new Temp()
t.setB("b");
t.setC("c");
session.save(t); //<---HERE
List list = session.find("from Temp as t where t.b='b'");
for (int i = 0; i < list.size(); i++) {
   Temp t2 = (Temp)list.get(i);
   System.out.println(t2.getC());
}


You do not need to do anything special to see changes


Hi Gavin

But it's a newly created object, not one loaded by the session. If I don't do a save(), how would the session know about t at all? In fact, I tried taking out the save() call and hibernate didn't issue any INSERT statement at all...

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 10:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Ummm, dude, the code you posted had no call to save:

Quote:
Temp t = new Temp()
t.setB("b");
t.setC("c");
List list = session.find("from Temp as t where t.b='b'");
for (int i = 0; i < list.size(); i++) {
Temp t2 = (Temp)list.get(i);
System.out.println(t2.getC());
}


I added the line with the "HERE" comment.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 9:20 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 6:15 am
Posts: 22
Arrgh, ok, sorry, I typed in the code in my browser but the actual does have the save() call. And no, I just tested it again. A find() call can't see objects created by save().

gavin wrote:
Ummm, dude, the code you posted had no call to save:

Quote:
Temp t = new Temp()
t.setB("b");
t.setC("c");
List list = session.find("from Temp as t where t.b='b'");
for (int i = 0; i < list.size(); i++) {
Temp t2 = (Temp)list.get(i);
System.out.println(t2.getC());
}


I added the line with the "HERE" comment.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 9:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well then, show more information. Starting with the Hibernate debug log.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 9:32 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 6:15 am
Posts: 22
gavin wrote:
Well then, show more information. Starting with the Hibernate debug log.


Thanks, Gavin. Here is the last bit of the Hibernate log.

- 2003-12-04 09:26:22,811 - DEBUG - main - net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
- 2003-12-04 09:26:22,811 - DEBUG - main - net.sf.hibernate.impl.SessionFactoryImpl - prepared statement get: select CMS_ASSET_ID_SQ.nextval from dual
Hibernate: select CMS_ASSET_ID_SQ.nextval from dual
- 2003-12-04 09:26:22,811 - DEBUG - main - net.sf.hibernate.impl.SessionFactoryImpl - preparing statement
- 2003-12-04 09:26:23,019 - DEBUG - main - net.sf.hibernate.id.SequenceGenerator - Sequence identifier generated: 84863
- 2003-12-04 09:26:23,019 - DEBUG - main - net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
- 2003-12-04 09:26:23,019 - DEBUG - main - net.sf.hibernate.impl.SessionFactoryImpl - closing statement
- 2003-12-04 09:26:23,020 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - saving [db.cms.AssetImpl#84863]
ID: 84863
- 2003-12-04 09:26:23,026 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - flushing session
- 2003-12-04 09:26:23,028 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
- 2003-12-04 09:26:23,030 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
- 2003-12-04 09:26:23,030 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
- 2003-12-04 09:26:23,030 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
- 2003-12-04 09:26:23,030 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
- 2003-12-04 09:26:23,031 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - executing flush
- 2003-12-04 09:26:23,031 - DEBUG - main - net.sf.hibernate.persister.EntityPersister - Inserting entity: db.cms.AssetImpl#84863
- 2003-12-04 09:26:23,031 - DEBUG - main - net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
- 2003-12-04 09:26:23,031 - DEBUG - main - net.sf.hibernate.impl.SessionFactoryImpl - prepared statement get: insert into CMS_ASSET (CUSTOMER_ASSET_ID, IS_OPENED, COMP_ASSET_TYPE_ID, IS_SEALED, DEFAULT_ATTRIBUTE_FLAG, IS_PUBLISHED, ACTIVE_STATUS, IS_REFERENCED, ASSET_STATUS_ID, ASSET_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into CMS_ASSET (CUSTOMER_ASSET_ID, IS_OPENED, COMP_ASSET_TYPE_ID, IS_SEALED, DEFAULT_ATTRIBUTE_FLAG, IS_PUBLISHED, ACTIVE_STATUS, IS_REFERENCED, ASSET_STATUS_ID, ASSET_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- 2003-12-04 09:26:23,031 - DEBUG - main - net.sf.hibernate.impl.SessionFactoryImpl - preparing statement
- 2003-12-04 09:26:23,032 - DEBUG - main - net.sf.hibernate.persister.EntityPersister - Dehydrating entity: db.cms.AssetImpl#84863
- 2003-12-04 09:26:23,032 - DEBUG - main - net.sf.hibernate.type.StringType - binding 'KEVIN' to parameter: 1
- 2003-12-04 09:26:23,314 - DEBUG - main - net.sf.hibernate.type.DoubleType - binding '0.0' to parameter: 2
- 2003-12-04 09:26:23,314 - DEBUG - main - net.sf.hibernate.type.LongType - binding '1' to parameter: 3
- 2003-12-04 09:26:23,314 - DEBUG - main - net.sf.hibernate.type.StringType - binding '10' to parameter: 4
- 2003-12-04 09:26:23,314 - DEBUG - main - net.sf.hibernate.type.StringType - binding '1' to parameter: 5
- 2003-12-04 09:26:23,314 - DEBUG - main - net.sf.hibernate.type.DoubleType - binding '0.0' to parameter: 6
- 2003-12-04 09:26:23,315 - DEBUG - main - net.sf.hibernate.type.StringType - binding '1' to parameter: 7
- 2003-12-04 09:26:23,315 - DEBUG - main - net.sf.hibernate.type.DoubleType - binding '0.0' to parameter: 8
- 2003-12-04 09:26:23,315 - DEBUG - main - net.sf.hibernate.type.DoubleType - binding '1.0' to parameter: 9
- 2003-12-04 09:26:23,316 - DEBUG - main - net.sf.hibernate.type.LongType - binding '84863' to parameter: 10
- 2003-12-04 09:26:23,316 - DEBUG - main - net.sf.hibernate.impl.BatcherImpl - Adding to batch
- 2003-12-04 09:26:23,317 - DEBUG - main - net.sf.hibernate.impl.BatcherImpl - Executing batch size: 1
- 2003-12-04 09:26:23,326 - DEBUG - main - net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
- 2003-12-04 09:26:23,326 - DEBUG - main - net.sf.hibernate.impl.SessionFactoryImpl - closing statement
- 2003-12-04 09:26:23,326 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - post flush
- 2003-12-04 09:26:23,326 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - find: from db.cms.AssetImpl as a where a.customerAssetId='KEVIN'
- 2003-12-04 09:26:23,347 - DEBUG - main - net.sf.hibernate.hql.QueryTranslator - compiling query
- 2003-12-04 09:26:23,380 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - flushing session
- 2003-12-04 09:26:23,380 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
- 2003-12-04 09:26:23,380 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
- 2003-12-04 09:26:23,380 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
- 2003-12-04 09:26:23,380 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
- 2003-12-04 09:26:23,380 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
- 2003-12-04 09:26:23,380 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Dont need to execute flush
- 2003-12-04 09:26:23,380 - DEBUG - main - net.sf.hibernate.hql.QueryTranslator - HQL: from db.cms.AssetImpl as a where a.customerAssetId='KEVIN'
- 2003-12-04 09:26:23,381 - DEBUG - main - net.sf.hibernate.hql.QueryTranslator - SQL: select assetimp0_.ASSET_ID as ASSET_ID, assetimp0_.CUSTOMER_ASSET_ID as CUSTOMER2_, assetimp0_.IS_OPENED as IS_OPENED, assetimp0_.LAST_LINK_LOG_ID as LAST_LIN4_, assetimp0_.COMP_ASSET_TYPE_ID as COMP_ASS5_, assetimp0_.IS_SEALED as IS_SEALED, assetimp0_.IMAGE_LINK as IMAGE_LINK, assetimp0_.PRIOR_ASSET_ID as PRIOR_AS8_, assetimp0_.ASSET_DESCRIPTION as ASSET_DE9_, assetimp0_.PLANNED_NEXT_ASSET_ID as PLANNED10_, assetimp0_.LAST_RECORDED_ZONE_ID as LAST_RE11_, assetimp0_.LAST_LATITUDE as LAST_LA12_, assetimp0_.CREATE_WHO as CREATE_WHO, assetimp0_.DEFAULT_ATTRIBUTE_FLAG as DEFAULT14_, assetimp0_.PARENT_ASSET_ID as PARENT_15_, assetimp0_.PLANNED_PRIOR_ASSET_ID as PLANNED16_, assetimp0_.LAST_RECORDED_TIME as LAST_RE17_, assetimp0_.LAST_VALIDATED_ACTIVITY_LOG_ID as LAST_VA18_, assetimp0_.ATTR2 as ATTR2, assetimp0_.IS_PUBLISHED as IS_PUBL20_, assetimp0_.ACTIVE_STATUS as ACTIVE_21_, assetimp0_.GLOBAL_CODE as GLOBAL_22_, assetimp0_.PERCENT_FULL as PERCENT23_, assetimp0_.ROUTE_LOG_ID as ROUTE_L24_, assetimp0_.LINK_LOG_ID as LINK_LO25_, assetimp0_.VERSION_COUNT as VERSION26_, assetimp0_.FULFILLMENT_ID as FULFILL27_, assetimp0_.LAST_MODIFY_DATE_GMT as LAST_MO28_, assetimp0_.IS_REFERENCED as IS_REFE29_, assetimp0_.LAST_MODIFY_LOCAL_TZ as LAST_MO30_, assetimp0_.NEXT_ASSET_ID as NEXT_AS31_, assetimp0_.CREATE_DATE_LOCAL as CREATE_32_, assetimp0_.ASSET_STATUS_ID as ASSET_S33_, assetimp0_.LAST_MODIFY_LOCAL_DATE as LAST_MO34_, assetimp0_.LAST_ROUTE_LOG_ID as LAST_RO35_, assetimp0_.LAST_MODIFY_WHO as LAST_MO36_, assetimp0_.ATTR1 as ATTR1, assetimp0_.PLANNED_PARENT_ASSET_ID as PLANNED38_, assetimp0_.LAST_LONGITUDE as LAST_LO39_, assetimp0_.IS_INSPECTED as IS_INSP40_, assetimp0_.CREATE_DATE_GMT as CREATE_41_, assetimp0_.ACTIVITY_LOG_ID as ACTIVIT42_, assetimp0_.GLOBAL_DESC as GLOBAL_43_, assetimp0_.SEAL_CODE as SEAL_CODE, assetimp0_.CREATE_LOCAL_TZ as CREATE_45_ from CMS_ASSET assetimp0_ where (assetimp0_.CUSTOMER_ASSET_ID='KEVIN' )
- 2003-12-04 09:26:23,406 - DEBUG - main - net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
- 2003-12-04 09:26:23,406 - DEBUG - main - net.sf.hibernate.impl.SessionFactoryImpl - prepared statement get: select assetimp0_.ASSET_ID as ASSET_ID, assetimp0_.CUSTOMER_ASSET_ID as CUSTOMER2_, assetimp0_.IS_OPENED as IS_OPENED, assetimp0_.LAST_LINK_LOG_ID as LAST_LIN4_, assetimp0_.COMP_ASSET_TYPE_ID as COMP_ASS5_, assetimp0_.IS_SEALED as IS_SEALED, assetimp0_.IMAGE_LINK as IMAGE_LINK, assetimp0_.PRIOR_ASSET_ID as PRIOR_AS8_, assetimp0_.ASSET_DESCRIPTION as ASSET_DE9_, assetimp0_.PLANNED_NEXT_ASSET_ID as PLANNED10_, assetimp0_.LAST_RECORDED_ZONE_ID as LAST_RE11_, assetimp0_.LAST_LATITUDE as LAST_LA12_, assetimp0_.CREATE_WHO as CREATE_WHO, assetimp0_.DEFAULT_ATTRIBUTE_FLAG as DEFAULT14_, assetimp0_.PARENT_ASSET_ID as PARENT_15_, assetimp0_.PLANNED_PRIOR_ASSET_ID as PLANNED16_, assetimp0_.LAST_RECORDED_TIME as LAST_RE17_, assetimp0_.LAST_VALIDATED_ACTIVITY_LOG_ID as LAST_VA18_, assetimp0_.ATTR2 as ATTR2, assetimp0_.IS_PUBLISHED as IS_PUBL20_, assetimp0_.ACTIVE_STATUS as ACTIVE_21_, assetimp0_.GLOBAL_CODE as GLOBAL_22_, assetimp0_.PERCENT_FULL as PERCENT23_, assetimp0_.ROUTE_LOG_ID as ROUTE_L24_, assetimp0_.LINK_LOG_ID as LINK_LO25_, assetimp0_.VERSION_COUNT as VERSION26_, assetimp0_.FULFILLMENT_ID as FULFILL27_, assetimp0_.LAST_MODIFY_DATE_GMT as LAST_MO28_, assetimp0_.IS_REFERENCED as IS_REFE29_, assetimp0_.LAST_MODIFY_LOCAL_TZ as LAST_MO30_, assetimp0_.NEXT_ASSET_ID as NEXT_AS31_, assetimp0_.CREATE_DATE_LOCAL as CREATE_32_, assetimp0_.ASSET_STATUS_ID as ASSET_S33_, assetimp0_.LAST_MODIFY_LOCAL_DATE as LAST_MO34_, assetimp0_.LAST_ROUTE_LOG_ID as LAST_RO35_, assetimp0_.LAST_MODIFY_WHO as LAST_MO36_, assetimp0_.ATTR1 as ATTR1, assetimp0_.PLANNED_PARENT_ASSET_ID as PLANNED38_, assetimp0_.LAST_LONGITUDE as LAST_LO39_, assetimp0_.IS_INSPECTED as IS_INSP40_, assetimp0_.CREATE_DATE_GMT as CREATE_41_, assetimp0_.ACTIVITY_LOG_ID as ACTIVIT42_, assetimp0_.GLOBAL_DESC as GLOBAL_43_, assetimp0_.SEAL_CODE as SEAL_CODE, assetimp0_.CREATE_LOCAL_TZ as CREATE_45_ from CMS_ASSET assetimp0_ where (assetimp0_.CUSTOMER_ASSET_ID='KEVIN' )
Hibernate: select assetimp0_.ASSET_ID as ASSET_ID, assetimp0_.CUSTOMER_ASSET_ID as CUSTOMER2_, assetimp0_.IS_OPENED as IS_OPENED, assetimp0_.LAST_LINK_LOG_ID as LAST_LIN4_, assetimp0_.COMP_ASSET_TYPE_ID as COMP_ASS5_, assetimp0_.IS_SEALED as IS_SEALED, assetimp0_.IMAGE_LINK as IMAGE_LINK, assetimp0_.PRIOR_ASSET_ID as PRIOR_AS8_, assetimp0_.ASSET_DESCRIPTION as ASSET_DE9_, assetimp0_.PLANNED_NEXT_ASSET_ID as PLANNED10_, assetimp0_.LAST_RECORDED_ZONE_ID as LAST_RE11_, assetimp0_.LAST_LATITUDE as LAST_LA12_, assetimp0_.CREATE_WHO as CREATE_WHO, assetimp0_.DEFAULT_ATTRIBUTE_FLAG as DEFAULT14_, assetimp0_.PARENT_ASSET_ID as PARENT_15_, assetimp0_.PLANNED_PRIOR_ASSET_ID as PLANNED16_, assetimp0_.LAST_RECORDED_TIME as LAST_RE17_, assetimp0_.LAST_VALIDATED_ACTIVITY_LOG_ID as LAST_VA18_, assetimp0_.ATTR2 as ATTR2, assetimp0_.IS_PUBLISHED as IS_PUBL20_, assetimp0_.ACTIVE_STATUS as ACTIVE_21_, assetimp0_.GLOBAL_CODE as GLOBAL_22_, assetimp0_.PERCENT_FULL as PERCENT23_, assetimp0_.ROUTE_LOG_ID as ROUTE_L24_, assetimp0_.LINK_LOG_ID as LINK_LO25_, assetimp0_.VERSION_COUNT as VERSION26_, assetimp0_.FULFILLMENT_ID as FULFILL27_, assetimp0_.LAST_MODIFY_DATE_GMT as LAST_MO28_, assetimp0_.IS_REFERENCED as IS_REFE29_, assetimp0_.LAST_MODIFY_LOCAL_TZ as LAST_MO30_, assetimp0_.NEXT_ASSET_ID as NEXT_AS31_, assetimp0_.CREATE_DATE_LOCAL as CREATE_32_, assetimp0_.ASSET_STATUS_ID as ASSET_S33_, assetimp0_.LAST_MODIFY_LOCAL_DATE as LAST_MO34_, assetimp0_.LAST_ROUTE_LOG_ID as LAST_RO35_, assetimp0_.LAST_MODIFY_WHO as LAST_MO36_, assetimp0_.ATTR1 as ATTR1, assetimp0_.PLANNED_PARENT_ASSET_ID as PLANNED38_, assetimp0_.LAST_LONGITUDE as LAST_LO39_, assetimp0_.IS_INSPECTED as IS_INSP40_, assetimp0_.CREATE_DATE_GMT as CREATE_41_, assetimp0_.ACTIVITY_LOG_ID as ACTIVIT42_, assetimp0_.GLOBAL_DESC as GLOBAL_43_, assetimp0_.SEAL_CODE as SEAL_CODE, assetimp0_.CREATE_LOCAL_TZ as CREATE_45_ from CMS_ASSET assetimp0_ where (assetimp0_.CUSTOMER_ASSET_ID='KEVIN' )
- 2003-12-04 09:26:23,514 - DEBUG - main - net.sf.hibernate.impl.SessionFactoryImpl - preparing statement
- 2003-12-04 09:26:23,544 - DEBUG - main - net.sf.hibernate.loader.Loader - processing result set
- 2003-12-04 09:26:23,545 - DEBUG - main - net.sf.hibernate.loader.Loader - done processing result set (0 rows)
- 2003-12-04 09:26:23,545 - DEBUG - main - net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
- 2003-12-04 09:26:23,545 - DEBUG - main - net.sf.hibernate.impl.SessionFactoryImpl - closing statement
- 2003-12-04 09:26:23,545 - DEBUG - main - net.sf.hibernate.loader.Loader - total objects hydrated: 0
- 2003-12-04 09:26:23,545 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - loading [db.cms.AssetImpl#84863]
- 2003-12-04 09:26:23,546 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - attempting to resolve [db.cms.AssetImpl#84863]
- 2003-12-04 09:26:23,546 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - resolved object in session cache [db.cms.AssetImpl#84863]
KEVIN
- 2003-12-04 09:26:23,546 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - flushing session
- 2003-12-04 09:26:23,546 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
- 2003-12-04 09:26:23,546 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
- 2003-12-04 09:26:23,546 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
- 2003-12-04 09:26:23,546 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
- 2003-12-04 09:26:23,546 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
- 2003-12-04 09:26:23,546 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - executing flush
- 2003-12-04 09:26:23,546 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - post flush
- 2003-12-04 09:26:23,547 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - closing session
- 2003-12-04 09:26:23,547 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - disconnecting session
- 2003-12-04 09:26:23,547 - DEBUG - main - net.sf.hibernate.impl.SessionImpl - transaction completion


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 10:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well, quite clearly this problem is nothing to do with Hibernate, since Hibernate correctly inserts the row and then correctly executes the query, which returns 0 rows.

So why don't you try to make this work with direct SQL/JDBC first instead of immediately blaming Hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 10:35 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 6:15 am
Posts: 22
No, not blaming Hibernate. I was asking if I missed something and the reason I asked is that if I do save() then load(), I can get my object back. But if I do save() then find() I can't. As you can see, the string 'KEVIN' is set to CUSTOMER_ASSET_ID in the insert statement. The OQL/SQL then retrieves by CUSTOMER_ASSET_ID='KEVIN'. So, I'm puzzled why no row is returned.

gavin wrote:
Well, quite clearly this problem is nothing to do with Hibernate, since Hibernate correctly inserts the row and then correctly executes the query, which returns 0 rows.

So why don't you try to make this work with direct SQL/JDBC first instead of immediately blaming Hibernate.


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