Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Named query definition & configuration problem

  1. #11
    Join Date
    Sep 2004
    Location
    Singapore
    Posts
    24

    Default Bug In Hibernate3 : SessionFactoryImpl

    Quote Originally Posted by karldmoore View Post
    I would give Costins suggestion a try, up the logging to get some more information. It's hard to see what is going wrong here.
    Code:
    private Map checkNamedQueries() throws HibernateException {
    		Map errors = new HashMap();
    
    		// Check named HQL queries
    		log.debug("Checking " + namedQueries.size() + " named HQL queries");
    		Iterator itr = namedQueries.entrySet().iterator();
    		while ( itr.hasNext() ) {
    			final Map.Entry entry = ( Map.Entry ) itr.next();
    			final String queryName = ( String ) entry.getKey();
    			final NamedQueryDefinition qd = ( NamedQueryDefinition ) entry.getValue();
    			// this will throw an error if there's something wrong.
    			try {
    				log.debug("Checking named query: " + queryName);
    				//TODO: BUG! this currently fails for named queries for non-POJO entities
    				queryPlanCache.getHQLQueryPlan( qd.getQueryString(), false, CollectionHelper.EMPTY_MAP );
    			}
    			catch ( QueryException e ) {
    				errors.put( queryName, e );
    			}
    			catch ( MappingException e ) {
    				errors.put( queryName, e );
    			}
    		}

    There is a bug in the Hibernate 3 SessionFactoryImpl implemenation.
    I got a bug in a NamedQuery. Are you referring to the same ?

  2. #12
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    I think this problem was actually referring to starting the application. Hibernate was actually complaining that there was a problem with the named queries. I didn't managed to replicate this locally however. What is the problem that you are having?
    Last edited by karldmoore; Aug 30th, 2007 at 06:45 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  3. #13
    Join Date
    Sep 2004
    Location
    Singapore
    Posts
    24

    Default

    Quote Originally Posted by karldmoore View Post
    I think this problem was actually referring to starting the application. Hibernate was actually complaining that there was a problem with the named queries. I didn't managed to replicate this locally however. What is the problem that you are having?
    'named queries for non-POJO entities' Means I have an annotated POJO like the following and it simply failed to execute.

    Code:
    @Entity
    @Table(name = "employee")
    @NamedNativeQuery(name = "findEmployeesInSalaryRange", query = "select e from employee as e where e.salary between :minSalary and :maxSalary")
    public class Employee extends BaseObject {
    
    //properties
    
    }

    If you refer to the above method (in my pervious message) Gavin acknowledges the same in the comment.

  4. #14
    Join Date
    Sep 2004
    Location
    Singapore
    Posts
    24

    Default

    Quote Originally Posted by karldmoore View Post
    I think this problem was actually referring to starting the application. Hibernate was actually complaining that there was a problem with the named queries. I didn't managed to replicate this locally however. What is the problem that you are having?
    'named queries for non-POJO entities' Means I have an annotated POJO like the following and it simply failed to execute.

    Code:
    @Entity
    @Table(name = "employee")
    @NamedQuery(name = "findEmployeesInSalaryRange", query = "select e from employee as e where e.salary between :minSalary and :maxSalary")
    public class Employee extends BaseObject {
    
    //properties
    
    }

    Earlier query is a NamedQuery and not a NamedNativeQuery. Sorry for the mistake. This error came as I was experimenting whether NamedNativeQuery will work or not..


    NB: NamedNativeQuery is not currently supported by hibernate, this also fails

Similar Threads

  1. ERROR: Context initialization failed
    By makhlo in forum Architecture
    Replies: 8
    Last Post: Jul 11th, 2008, 01:41 AM
  2. Problem With Hibernate 3 Named Query
    By duffymo in forum Data
    Replies: 4
    Last Post: May 26th, 2007, 03:25 PM
  3. hibernate pagination
    By oliverchua in forum Data
    Replies: 8
    Last Post: Sep 23rd, 2005, 06:06 PM
  4. Replies: 2
    Last Post: Sep 5th, 2004, 10:49 AM
  5. Replies: 5
    Last Post: Aug 27th, 2004, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •