-->
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.  [ 2 posts ] 
Author Message
 Post subject: EJB QL - Constructor expressions
PostPosted: Fri Apr 06, 2007 10:27 am 
Newbie

Joined: Sun Dec 17, 2006 6:30 pm
Posts: 9
Hello,

I'm using JBoss 4.0.5.

I want to try to use the powerful feature of EJB QL to specify a constructor within the SELECT clause.
I have try this :

List fctResults = em.createQuery("SELECT" +
" new stesud.salaries.common.signa.Matricule(" +
" c300.tra_matric)" +
" FROM ..." +
" WHERE ..." +
" ORDER BY ...")
.setParameter("...",...)
.getResultList();

the column c300.tra_matric is a String.

But it always returns this error :
javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalArgumentException: org.hibernate.QueryException: could not instantiate: stesud.salaries.common.signa.Matricule

I have try with "new Matricule(...)" only but as the class is not on the same package it returns this error (which is normal) :
javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Unable to locate class [Matricule] [SELECT new Matricule( ...

So, why it could not be instantiate ???

Thanks for your help.

Olivier


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 06, 2007 6:42 pm 
Newbie

Joined: Thu Jun 09, 2005 2:49 pm
Posts: 6
Could you post the code for the class you are trying to instantiate and tell us what type of column is c300.tra_matric?
This is probably due to a couple of probable causes:
  1. The class is not available to hibernate's classpath
  2. The class is abstract
  3. The none of the class's constructors takes the argument types you are passing, e.g. tra_matric is a date and the constructor only takes an integer
  4. None of the class's constructors are accessible
  5. And, just for completeness cause I am sure you have checked and double checked it, the class's name is misspelled

Good Luck


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