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
|