-->
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.  [ 1 post ] 
Author Message
 Post subject: problem retrieving specific entities from the DB
PostPosted: Fri Nov 19, 2004 3:12 am 
Newbie

Joined: Wed May 12, 2004 7:59 am
Posts: 7
Thanks in Advance,

I have a simple one to many relationship between a material issue and material issue details tables mapped into POJOs with hibernate into Issue and IssueDetails Classes.

When i execute the query given below, for some dates i am encountering the following exception where hibernate is not able to retrieve records associated with specific issue numbers.

I check the database with a simple sql join query, got all the data. Then i wrote a simple jdbc test application and i got the result set with all data correctly.

But when i retrieve the records using hibernate i get the exception.

On further investigation i could that for some specific issue numbers hibernate is encountering a problem and so when those issue numbers belong to the date that i am querying, it blows the given exception.

Any help is appreciated.

Thank you.
Sarath.

Hibernate version: Hibernate2

Mapping documents:Issue and IssueDetails (one to many relationship)
Issue has Issue_id, date, and other header information, IssueDetails has IssueDetailId, IssueId (link to parent object), and other order details.


Code between sessionFactory.openSession()
....
session.find ("from Issue where issue_date = '2004-11-02'");
....
and session.close():


Full stack trace of any exception that occurs:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:460)
at net.sf.hibernate.type.CharacterType.get(CharacterType.java:23)
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.AbstractType.hydrate(AbstractType.java:66)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:611)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:552)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:511)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:426)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:209)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
at net.sf.hibernate.loader.Loader.list(Loader.java:946)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:846)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1520)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1512)
at com.quadone.hms.inventory.storagehandlers.IssueSH.findByDate(IssueSH.java:366)
at com.quadone.hms.inventory.storagehandlers.testers.IssuesFindByDateTester.testFindByDate(IssuesFindByDateTester.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:410)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:294)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:182)
java.lang.NullPointerException
null
at com.quadone.hms.inventory.storagehandlers.testers.IssuesFindByDateTester.testFindByDate(IssuesFindByDateTester.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:410)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:294)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:182)


Name and version of the database you are using:
MySql 4.0.20


The generated SQL (show_sql=true):
select issuebo0_.issue_id as issue_id, issuebo0_.indent_id as indent_id, issuebo0_.issue_type as issue_type, issuebo0_.patient_code as patient_4_, issuebo0_.patient_name as patient_5_, issuebo0_.is_credit as is_credit, issuebo0_.age as age, issuebo0_.address as address, issuebo0_.referral_doctor as referral9_, issuebo0_.issue_date as issue_date, issuebo0_.total_amount as total_a11_, issuebo0_.discount_type as discoun12_, issuebo0_.discount_amount as discoun13_, issuebo0_.tax as tax, issuebo0_.net_amount as net_amount, issuebo0_.from_stock_point_id as from_st16_, issuebo0_.to_stock_point_id as to_stoc17_, issuebo0_.remarks as remarks, issuebo0_.is_completed_issued as is_comp19_, issuebo0_.is_active as is_active from inv_issue_header issuebo0_ where (issue_date='2004-11-02' )

Debug level Hibernate log excerpt:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.