-->
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: StringIndexOutOfBoundsException while creating my Criteria
PostPosted: Fri Aug 06, 2004 11:50 pm 
Newbie

Joined: Fri Aug 06, 2004 10:22 pm
Posts: 3
Location: Illinois
Hibernate version: 2.1.4

Mapping documents: N/A

Code between sessionFactory.openSession() and session.close():
Criteria crit = session.createCriteria(UserReport.class);

crit.createAlias("user", "user")
.createAlias("user.customer", "cust")
.createAlias("report", "bankReport")
.createAlias("bankReport.bank", "bank")
.add(Expression.eq("user.id", new Long(user)))
.createCriteria("cust")
.add(Expression.eq("id", new Long(customer)))
.createCriteria("bank")
.add(Expression.eq("id", bank));
it = crit.list().iterator();


Full stack trace of any exception that occurs:
Exception data: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:2044)
at java.lang.String.substring(String.java:2011)
at net.sf.hibernate.impl.CriteriaImpl.createCriteriaAt(CriteriaImpl.java:360)
at net.sf.hibernate.impl.CriteriaImpl.createCriteriaAt(CriteriaImpl.java:353)
at net.sf.hibernate.impl.CriteriaImpl.createCriteria(CriteriaImpl.java:349)
at myEJB.UserReportManager.selectByBankCustomerUser(UserReportManager.java:75)

Name and version of the database you are using: Oracle 9i

Debug level Hibernate log excerpt: N/A

In HQL, here is what I am trying to do:

String query = "from UserBank as user where user.bankReport." +
"bank.id = ? and user.id = ? and user.customer.id = ?";

If I need to post the mapping files, I will, however that's alot of stuff to post. I'm hoping it's just my use of the criteria API. Any help would be appreciated. Thanks in advance

_________________
Michael Minella
Senior Consultant
Software Architects, Inc
SCJP, SCWCD, IBM OO/UML


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.