From: <leg...@at...> - 2003-06-15 05:45:04
|
The following comment has been added to this issue: Author: Gavin King Created: Sun, 15 Jun 2003 12:44 AM Body: I am unable to reproduce this problem, and I am inclined to disbelieve it exists. Please see FooBarTest.testSortables in CVS. If you want to progress this further, please submit a VERY simple test case. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-136 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-136 Summary: Criteria api appears to add elements to a SortedSet before setting their properties Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: core Versions: 2.0 final Assignee: Reporter: Paul Rivers Created: Sat, 14 Jun 2003 4:16 PM Updated: Sat, 14 Jun 2003 4:16 PM Environment: Eclipse 2.1, Tomcat4.1.24, jdk1.4.1_03 Description: As I understand it, this query by criteria query: Criteria criteria = session.createCriteria(EntryDAO.class); criteria.setFirstResult(rangeStart); criteria.setMaxResults(rangeSize); criteria.addOrder(Order.desc("dateCreated")); entries = criteria.list(); Should return the same results as this one: Query query = session.createQuery("from EntryDAO order by dateCreated desc"); query.setFirstResult(rangeStart); query.setMaxResults(rangeSize); entries = query.list(); The problem is that the normal (second) query executes fine, but the Criteria (first) query throws a NullPointerException. Each entry has a SortedSet of Categories (It's specified in the mapping file). The stack trace for the null pointer exception leads to this line: result = this.getName().compareTo(otherCategory.getName()); In this function: public int compareTo(Object o) { int result; CategoryDAO otherCategory = (CategoryDAO) o; result = this.getDisplayIndex() - otherCategory.getDisplayIndex(); if(result == 0) { result = this.getName().compareTo(otherCategory.getName()); } return result; } The problem appears to be, to me, that for some reason the Criteria API 1. does the database query, 2. adds the new object to the SortedSet, 3. THEN sets it's properties, where it should be 1. doing the query 2. setting the properties, 3. then adding the category to the sortedset. PLEASE let me know if there's anything I can do to help with the issue, or if there's any other information you would like. Thanks. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2003-06-17 19:07:20
|
The following comment has been added to this issue: Author: Paul Rivers Created: Tue, 17 Jun 2003 2:06 PM Body: FYI: I will be on vacation, but I will work on creating a simple test case when I get back. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-136 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-136 Summary: Criteria api appears to add elements to a SortedSet before setting their properties Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: core Versions: 2.0 final Assignee: Reporter: Paul Rivers Created: Sat, 14 Jun 2003 4:16 PM Updated: Sat, 14 Jun 2003 4:16 PM Environment: Eclipse 2.1, Tomcat4.1.24, jdk1.4.1_03 Description: As I understand it, this query by criteria query: Criteria criteria = session.createCriteria(EntryDAO.class); criteria.setFirstResult(rangeStart); criteria.setMaxResults(rangeSize); criteria.addOrder(Order.desc("dateCreated")); entries = criteria.list(); Should return the same results as this one: Query query = session.createQuery("from EntryDAO order by dateCreated desc"); query.setFirstResult(rangeStart); query.setMaxResults(rangeSize); entries = query.list(); The problem is that the normal (second) query executes fine, but the Criteria (first) query throws a NullPointerException. Each entry has a SortedSet of Categories (It's specified in the mapping file). The stack trace for the null pointer exception leads to this line: result = this.getName().compareTo(otherCategory.getName()); In this function: public int compareTo(Object o) { int result; CategoryDAO otherCategory = (CategoryDAO) o; result = this.getDisplayIndex() - otherCategory.getDisplayIndex(); if(result == 0) { result = this.getName().compareTo(otherCategory.getName()); } return result; } The problem appears to be, to me, that for some reason the Criteria API 1. does the database query, 2. adds the new object to the SortedSet, 3. THEN sets it's properties, where it should be 1. doing the query 2. setting the properties, 3. then adding the category to the sortedset. PLEASE let me know if there's anything I can do to help with the issue, or if there's any other information you would like. Thanks. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2003-06-17 19:09:16
|
The following comment has been added to this issue: Author: Paul Rivers Created: Tue, 17 Jun 2003 2:07 PM Body: I will be on vacation for the rest of the week, but I will work on a simple test case when I return. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-136 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-136 Summary: Criteria api appears to add elements to a SortedSet before setting their properties Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: core Versions: 2.0 final Assignee: Reporter: Paul Rivers Created: Sat, 14 Jun 2003 4:16 PM Updated: Sat, 14 Jun 2003 4:16 PM Environment: Eclipse 2.1, Tomcat4.1.24, jdk1.4.1_03 Description: As I understand it, this query by criteria query: Criteria criteria = session.createCriteria(EntryDAO.class); criteria.setFirstResult(rangeStart); criteria.setMaxResults(rangeSize); criteria.addOrder(Order.desc("dateCreated")); entries = criteria.list(); Should return the same results as this one: Query query = session.createQuery("from EntryDAO order by dateCreated desc"); query.setFirstResult(rangeStart); query.setMaxResults(rangeSize); entries = query.list(); The problem is that the normal (second) query executes fine, but the Criteria (first) query throws a NullPointerException. Each entry has a SortedSet of Categories (It's specified in the mapping file). The stack trace for the null pointer exception leads to this line: result = this.getName().compareTo(otherCategory.getName()); In this function: public int compareTo(Object o) { int result; CategoryDAO otherCategory = (CategoryDAO) o; result = this.getDisplayIndex() - otherCategory.getDisplayIndex(); if(result == 0) { result = this.getName().compareTo(otherCategory.getName()); } return result; } The problem appears to be, to me, that for some reason the Criteria API 1. does the database query, 2. adds the new object to the SortedSet, 3. THEN sets it's properties, where it should be 1. doing the query 2. setting the properties, 3. then adding the category to the sortedset. PLEASE let me know if there's anything I can do to help with the issue, or if there's any other information you would like. Thanks. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2003-06-19 02:42:02
|
The following comment has been added to this issue: Author: Paul Rivers Created: Wed, 18 Jun 2003 9:41 PM Body: <p>Unfortunately I got sick today so I wasn't able to go on vacation, but I came up with as simple as a test case as I could get. <p>Source code is at: <br>http://paulrivers.dnsalias.com/HibernateBug.zip <br>Install source code (It's an Eclipse2.1.0 project) <p>Start up a MySQL server. <br>Create a database named "hibernatebug" <br>Create a user for the database named "hibernatebug" with a password of "hibernatebug" <p>Run hibernatebug.MainInitializeTestData to create the tables and the data <br>Run hibernatebug.MainDoQueryThatCrashes. A NullPointerException is thrown that shouldn't be thrown. <p>If you add <br>this.setName(""); <br>in the CategoryDAO default constructor, no NullPointerException <br>is thrown because the name is set by the default constructor. (Although it hasn't been set <br>by a call to setName() yet) --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-136 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-136 Summary: Criteria api appears to add elements to a SortedSet before setting their properties Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: core Versions: 2.0 final Assignee: Reporter: Paul Rivers Created: Sat, 14 Jun 2003 4:16 PM Updated: Sat, 14 Jun 2003 4:16 PM Environment: Eclipse 2.1, Tomcat4.1.24, jdk1.4.1_03 Description: As I understand it, this query by criteria query: Criteria criteria = session.createCriteria(EntryDAO.class); criteria.setFirstResult(rangeStart); criteria.setMaxResults(rangeSize); criteria.addOrder(Order.desc("dateCreated")); entries = criteria.list(); Should return the same results as this one: Query query = session.createQuery("from EntryDAO order by dateCreated desc"); query.setFirstResult(rangeStart); query.setMaxResults(rangeSize); entries = query.list(); The problem is that the normal (second) query executes fine, but the Criteria (first) query throws a NullPointerException. Each entry has a SortedSet of Categories (It's specified in the mapping file). The stack trace for the null pointer exception leads to this line: result = this.getName().compareTo(otherCategory.getName()); In this function: public int compareTo(Object o) { int result; CategoryDAO otherCategory = (CategoryDAO) o; result = this.getDisplayIndex() - otherCategory.getDisplayIndex(); if(result == 0) { result = this.getName().compareTo(otherCategory.getName()); } return result; } The problem appears to be, to me, that for some reason the Criteria API 1. does the database query, 2. adds the new object to the SortedSet, 3. THEN sets it's properties, where it should be 1. doing the query 2. setting the properties, 3. then adding the category to the sortedset. PLEASE let me know if there's anything I can do to help with the issue, or if there's any other information you would like. Thanks. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |