[Hibernate-JIRA] Created: (HHH-4570) Session.load(Class, id) fails with MappingException if entity names mapped
by Jeremy Stone (JIRA)
Session.load(Class, id) fails with MappingException if entity names mapped
--------------------------------------------------------------------------
Key: HHH-4570
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4570
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.0.SP1
Environment: Windows XP
Reporter: Jeremy Stone
Attachments: testcase.zip
If map an entity with entity-name Session.load(Class clazz, Serializable id) fails with MappingException:
org.hibernate.MappingException: Unknown entity: test.AImpl
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:91)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:822)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:815)
...
load(String entityName, Serializable id) works though.
It also appears inconsistent with e.g. Session.createCriteria(...) which, in its various forms, works for entity names, class names or classes. (On a separate note, the entity name override of createCriteria can be slow as a result of its reliance on a thrown ClassNotFoundException (at least with the locking behaviour of the JBoss RepositoryClassLoader)).
A simple test case is attached.
--
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/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Created: (EJB-384) JPQL Constructor Queries containing Timestamp cause exception
by Bjorn Beskow (JIRA)
JPQL Constructor Queries containing Timestamp cause exception
-------------------------------------------------------------
Key: EJB-384
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-384
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.3.1.GA
Environment: Hibernate 3.3.1.GA, Derby, JDK1.5, Windows.
Reporter: Bjorn Beskow
Priority: Minor
Attachments: hibernate-jpql-timestamp-bug.zip
When a constructor JPQL query projects a Timestamp, it causes an org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor.
For example, given the following Entity:
@Entity
public class Employee {
...
private Timestamp lastUpdatedAsTimestamp;
...
}
and the following Pojo for the constructor query:
public EmployeeDto(String name, Timestamp lastUpdated) {...}
the following query will throw an exception:
String query =
"SELECT new test.dto.EmployeeDtoUsingTimestamp(e.name, e.lastUpdatedAsTimestamp) " +
"FROM Employee e ORDER BY e.name";
List<EmployeeDto> reportList = em.createQuery(query).getResultList();
java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [test.dto.EmployeeDto] [SELECT new test.dto.EmployeeDto(e.name, e.lastUpdated) FROM test.entities.Employee e ORDER BY e.name]
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:601)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:96)
at test.ConstructorQueryTest.testEmployeesQuery(ConstructorQueryTest.java:63)
...
This problem has been reported before (see HHH-278), but the workaround is not a portable JPA solution (having the type Timestamp in the Entity and the type Date in the Pojo constructor is not in line with the Spec, and does not work in other JPA implementations).
I have attached a minimal Maven project with a test case which highlights the problem.
--
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/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1829) Allow join on any property using property-ref
by Anthony Patricio (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829?page=c... ]
Anthony Patricio commented on HHH-1829:
---------------------------------------
Hi Mathieu,
I ported and tested the patch on trunk.
Here are my comments:
- it works, makes the feature available
- it doesn't impact the results of the testsuite so no new bugs
HOWEVER
- hibernate annotation doesn't compile anymore, that's a first big issue
- the impact is huge and complex, SingleTableEntityPersister, Queryable,Loadable,EntityPersister, PersistentClass, MultiTableUpdateExecutor, MultiTableDeleteExecutor, AbstractStatementExecutor but mainly in AbstractEntityPersister
These changes make the code more complex to maintain.
Did you think of other ways this could be implemented or was it the only option available?
In a future release (3.6/3.7), a new metadata API will be available. It will offer the ability to point a FK at a column other than the PK. This is exactly what is needed here but unfortunately not easy at all with the current design. Maybe it could be much more interesting to wait until 3.6/3.7. What do you think?
> Allow join on any property using property-ref
> ---------------------------------------------
>
> Key: HHH-1829
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829
> Project: Hibernate Core
> Issue Type: New Feature
> Components: metamodel
> Affects Versions: 3.2.0 cr1, 3.2.0.cr2
> Reporter: Maarten Winkels
> Assignee: Anthony Patricio
> Attachments: AbstractJoinTest.java, HHH-1829-3.2.8-SNAPSHOT.patch, HHH-1829-mwinkels.patch, hhh-1829.patch, JoinNoPropertyRefTest.java, JoinPropertyRefTest.java, Person.hbm.xml, Person.java, PersonNoPropertyRef.hbm.xml
>
>
> Currently joining tables for one class (uing the <join...> tag) is only supported for the id property. The property-ref is allowed on the <key..> tag inside the <join..> tag, but this is ignored.
--
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/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-4566) Maven deps: JAXB API and JAXB RI shouldn't be dependencies of Hibernate Annotations.
by Tomasz Blachowicz (JIRA)
Maven deps: JAXB API and JAXB RI shouldn't be dependencies of Hibernate Annotations.
------------------------------------------------------------------------------------
Key: HHH-4566
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4566
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.5.0-Beta-2
Reporter: Tomasz Blachowicz
Priority: Minor
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Sandbox: JPA2
[INFO] task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree]
[INFO] sandbox:japa2:jar:1.0-SNAPSHOT
[INFO] \- org.hibernate:hibernate-annotations:jar:3.5.0-Beta-2:compile
[INFO] +- org.hibernate:hibernate-core:jar:3.5.0-Beta-2:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | \- javax.transaction:jta:jar:1.1:compile
[INFO] +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Beta1:compile
[INFO] +- org.hibernate.java-persistence:jpa-api:jar:2.0-cr-1:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.1.3:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.5.8:compile
[INFO] \- hsqldb:hsqldb:jar:1.8.0.2:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Wed Nov 11 14:52:50 GMT 2009
[INFO] Final Memory: 9M/19M
[INFO] ------------------------------------------------------------------------
--
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/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-4565) Maven deps: HSQLDB shouldn't be a dependency in compile scope.
by Tomasz Blachowicz (JIRA)
Maven deps: HSQLDB shouldn't be a dependency in compile scope.
--------------------------------------------------------------
Key: HHH-4565
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4565
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Beta-2
Reporter: Tomasz Blachowicz
Priority: Minor
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Sandbox: JPA2
[INFO] task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree]
[INFO] sandbox:jpa2:jar:1.0-SNAPSHOT
[INFO] \- org.hibernate:hibernate-core:jar:3.5.0-Beta-2:compile
[INFO] +- antlr:antlr:jar:2.7.6:compile
[INFO] +- commons-collections:commons-collections:jar:3.1:compile
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- javax.transaction:jta:jar:1.1:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.5.8:compile
[INFO] \- hsqldb:hsqldb:jar:1.8.0.2:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Wed Nov 11 14:46:15 GMT 2009
[INFO] Final Memory: 10M/19M
[INFO] ------------------------------------------------------------------------
--
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/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1400) Using formula-based property causes invalid SQL code for children "subselect" query
by Abbas Adel (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1400?page=c... ]
Abbas Adel commented on HHH-1400:
---------------------------------
Any updates on this?
> Using formula-based property causes invalid SQL code for children "subselect" query
> -----------------------------------------------------------------------------------
>
> Key: HHH-1400
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1400
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate 3.0.5, Hibernate 3.1rc3
> Oracle 8i
> Reporter: Chris Rogers
> Attachments: SubselectFetch.java, subselectformula.zip, SubselectFormulaBug.zip
>
>
> I have simple one-to-many relationship, mapped as set:
> <class name="Parent">
> <set name="children" lazy="false" fetch="subselect">
> <key column="PARENT_OID"/>
> <one-to-many class="Child"/>
> </set>
> </class>
> this works fine, constructing subselect SQL which looks like (e.g. for HQL query "from Parent"):
> select <child fields> from <child table> where child.PARENT_OID in (select this_.OID from PARENT this_)
> (simplified)
> However, when adding a formula-based property into Parent:
> <property name="myFormulaField" formula="(complex_select )"/>
> Now SQL becomes:
> select <child fields> from <child table> where PARENT_OID in (complex_select) as formula0_1_, <some parent fields> from PARENT this_)
> This SQL fails because of incorrect grammar (it also seems that backet is missing).
> This is something weird, because subselect fetching only needs Parent's identity column, not any other properties. And I don't think it should be affected by Parent's formula-based properties.
> I can provide more details if necessary, I stripped out all extra mapping/SQL stuff because it seems to be irrelevant here.
> This bug appeared in 3.0.5 later I've downloaded 3.1rc3 and it also fails.
--
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/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months