Hi Emmanuel,
thanks for your response!
emmanuel wrote:
You mean you have a list of one result
this result is not null, it's a QAItem but all those fields are null
assertNull( ie qaItem.getId() );
Yes, exactly. To very explicit, this is what I get from toString on the results-list:
Code:
[[Id: null Question:null AnswerCaption:null AnswerDetails:null]]
More details:
1) I have also tried to call with a regular Hibernate Session/Query and the object is there in the database. If I change the question, the list length changes. So it seems that this is somehow the right object, but it has no values for some reason.
2) Perhaps some versions don't play with each other? I am using lucene-core-2.0.0.jar (tried 2.1.0 but it complained that a method was missing); hibernate-annotations-3.2.1.jar; hibernate-3.2.2.jar; lucene-snowball-2.1.0.jar; lucene-wordnet-2.1.0.jar; hibernate-3.2.2.jar; hibernate-commons-annotations.jar
Quote:
I can't see how this happen. Hibernate Search retrieve the object from hibernate (session.get()) underneath.
Can you play with your debugger to see what is going on (BTW don't check the field nullability through your debugger, some don't play nice with Hibernate proxy generation
I am not really using a debugger but I can give you Log4J debug print outs. Sorry for long printout. The printout starts from when the method given above is called (its in the LuceneRetrieveFiler class). I added flush and close to the code as a test but that did not change anything...
Its seems that the answer "is there" for a while but then I get nulls in the printout further on. The returns from NullableType looks ok: first comes the answerCaption then answerDetails. These are the correct strings seen in the debug.
An interesting details (perhaps) is that Printer debug shows the result correctly *after* the log only shows nulls...which looks strange. Not sure why Printer is called though perhaps due to flush.
Suggestions??
Code:
[java] DEBUG [main] (LuceneRetrieveFilter.java:77) - Executing FAQ question: "What is this newsgroup"
[java] DEBUG [main] (DefaultLoadEventListener.java:171) - loading entity: [se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (DefaultLoadEventListener.java:255) - creating new proxy for entity
[java] DEBUG [main] (JDBCContext.java:233) - after autocommit
[java] DEBUG [main] (ConnectionManager.java:402) - aggressively releasing JDBC connection
[java] DEBUG [main] (SessionImpl.java:422) - after transaction completion
[java] DEBUG [main] (SessionImpl.java:832) - initializing proxy: [se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (DefaultLoadEventListener.java:332) - attempting to resolve: [se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (DefaultLoadEventListener.java:369) - object not resolved in any cache: [se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (AbstractEntityPersister.java:3031) - Fetching entity: [se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (Loader.java:1843) - loading entity: [se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (AbstractBatcher.java:358) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
[java] DEBUG [main] (ConnectionManager.java:419) - opening JDBC connection
[java] DEBUG [main] (AbstractBatcher.java:393) - select qaitem0_.id as id3_0_, qaitem0_.question as question3_0_, qaitem0_.answerCaption as answerCa3_3_0_, qaitem0_.answerDetails as answerDe4_3_0_, qaitem0_.qaItemStatus as qaItemSt5_3_0_, qaitem0_.dialogId as dialogId3_0_ from QAItem qaitem0_ where qaitem0_.id=?
[java] DEBUG [main] (AbstractBatcher.java:476) - preparing statement
[java] DEBUG [main] (NullableType.java:133) - binding '2' to parameter: 1
[java] DEBUG [main] (AbstractBatcher.java:374) - about to open ResultSet (open ResultSets: 0, globally: 0)
[java] DEBUG [main] (Loader.java:682) - processing result set
[java] DEBUG [main] (Loader.java:687) - result set row: 0
[java] DEBUG [main] (Loader.java:1164) - result row: EntityKey[se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (Loader.java:1346) - Initializing object from ResultSet: [se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (AbstractEntityPersister.java:2027) - Hydrating entity: [se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (NullableType.java:172) - returning 'What is this newsgroup' as column: question3_0_
[java] DEBUG [main] (NullableType.java:172) - returning 'comp.dcom.sys.cisco, which is ' as column: answerCa3_3_0_
[java] DEBUG [main] (NullableType.java:172) - returning 'comp.dcom.sys.cisco, which is gatewayed to the mailing list<a href="mailto:cisco@spot.colorado.edu">cisco@spot.colorado.edu</a>, is a newsgroup for discussion of ciscohardware, software, and related issues. Remember that you can alsoconsult with cisco tec' as column: answerDe4_3_0_
[java] DEBUG [main] (EnumType.java:79) - Returning null as column qaItemSt5_3_0_
[java] DEBUG [main] (NullableType.java:166) - returning null as column: dialogId3_0_
[java] DEBUG [main] (Loader.java:709) - done processing result set (1 rows)
[java] DEBUG [main] (AbstractBatcher.java:381) - about to close ResultSet (open ResultSets: 1, globally: 1)
[java] DEBUG [main] (AbstractBatcher.java:366) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
[java] DEBUG [main] (AbstractBatcher.java:525) - closing statement
[java] DEBUG [main] (Loader.java:839) - total objects hydrated: 1
[java] DEBUG [main] (TwoPhaseLoad.java:107) - resolving associations for [se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (TwoPhaseLoad.java:206) - done materializing entity [se.icepeak.acc.datamodel.QAItem#2]
[java] DEBUG [main] (StatefulPersistenceContext.java:777) - initializing non-lazy collections
[java] DEBUG [main] (Loader.java:1874) - done entity load
[java] DEBUG [main] (LuceneRetrieveFilter.java:89) - Got results: [[Id: null Question:null AnswerCaption:null AnswerDetails:null]]
[java] DEBUG [main] (AbstractFlushingEventListener.java:58) - flushing session
[java] DEBUG [main] (AbstractFlushingEventListener.java:111) - processing flush-time cascades
[java] DEBUG [main] (AbstractFlushingEventListener.java:154) - dirty checking collections
[java] DEBUG [main] (AbstractFlushingEventListener.java:171) - Flushing entities and processing referenced collections
[java] DEBUG [main] (AbstractFlushingEventListener.java:210) - Processing unreferenced collections
[java] DEBUG [main] (AbstractFlushingEventListener.java:224) - Scheduling collection removes/(re)creates/updates
[java] DEBUG [main] (AbstractFlushingEventListener.java:85) - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
[java] DEBUG [main] (AbstractFlushingEventListener.java:91) - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
[java] DEBUG [main] (Printer.java:83) - listing entities:
[java] DEBUG [main] (Printer.java:90) - se.icepeak.acc.datamodel.QAItem{id=2, qaItemStatus=null, answerDetails=comp.dcom.sys.cisco, which is gatewayed to the mailing list<a href="mailto:cisco@spot.colorado.edu">cisco@spot.colorado.edu</a>, is a newsgroup for discussion of ciscohardware, software, and related issues. Remember that you can alsoconsult with cisco tec, answerCaption=comp.dcom.sys.cisco, which is , question=What is this newsgroup, dialogId=null}
[java] DEBUG [main] (AbstractFlushingEventListener.java:290) - executing flush
[java] DEBUG [main] (ConnectionManager.java:467) - registering flush begin
[java] DEBUG [main] (ConnectionManager.java:476) - registering flush end
[java] DEBUG [main] (AbstractFlushingEventListener.java:321) - post flush
[java] DEBUG [main] (SessionImpl.java:273) - closing session
[java] DEBUG [main] (ConnectionManager.java:378) - performing cleanup
[java] DEBUG [main] (ConnectionManager.java:439) - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
[java] DEBUG [main] (JDBCContext.java:215) - after transaction completion
[java] DEBUG [main] (ConnectionManager.java:402) - aggressively releasing JDBC connection
[java] DEBUG [main] (SessionImpl.java:422) - after transaction completion
[java] DEBUG [main] (Explore.java:224) - No reset of FAQ