[Hibernate-JIRA] Created: (METAGEN-63) Parameter for additional entity mapping files is ormXmlList but not ormXml
by Ralph Engelmann (JIRA)
Parameter for additional entity mapping files is ormXmlList but not ormXml
--------------------------------------------------------------------------
Key: METAGEN-63
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-63
Project: Hibernate Metamodel Generator
Issue Type: Bug
Components: documentation
Affects Versions: 1.1.1.Final
Reporter: Ralph Engelmann
Assignee: Hardy Ferentschik
Priority: Trivial
In the "Hibernate JPA 2 Metamodel Generator - Reference Guide" 1.1.1.Final, the parameter to llows to specify additional entity mapping files is {{orm.xml}}.
{quote}
2.3. Processor specific options
...
|ormXml|Allows to specify additional entity mapping files. The specified value for this option is a comma separated string of mapping file names. Even when this option is specified /META-INF/orm.xml is implicit.|
{quote}
But in the code it is {{ormXmlList}}.
{code:title=JPAMetaModelEntityProcessor line 77}
public static final String ORM_XML_OPTION = "ormXmlList";
{code}
One of them should be changed so that documentation and code match.
--
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
13 years
[Hibernate-JIRA] Created: (METAGEN-56) Missing Singular attribute in import when merging attributes
by Martijn Blankestijn (JIRA)
Missing Singular attribute in import when merging attributes
------------------------------------------------------------
Key: METAGEN-56
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-56
Project: Hibernate Metamodel Generator
Issue Type: Bug
Components: processor
Affects Versions: 1.1.1.Final
Environment: maven 3.0.2
Java: java version "1.6.0_22", Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Uname: Linux xxx 2.6.32-28-generic-pae #55-Ubuntu SMP Mon Jan 10 22:34:08 UTC 2011 i686 GNU/Linux
Reporter: Martijn Blankestijn
Assignee: Hardy Ferentschik
Attachments: 0001-Missing-SingularAttribute-import-with-mixed-xml-and-.patch, surefire-reports.tar.gz
I have failing testcases due to a missing import in the Generated ZeroCoordinates_.java.
My analysis:
The import "import javax.persistence.metamodel.SingularAttribute;" is not added to the file ZeroCoordinates_.java and will not compile due to this missing dependency.
It is a mixed configuration: so in the class JPAMetaModelEntityProcessor (line 237) the call is made to
metaEntity.mergeInMembers( alreadyExistingMetaEntity.getMembers() );
This basically means that the attributes of the already existing XML MetaEntity are placed in the attributesMap of the AnnotationMetaEntity.
public void mergeInMembers(Collection<MetaAttribute> attributes) {
for ( MetaAttribute attribute : attributes ) {
members.put( attribute.getPropertyName(), attribute );
}
}
This means that the AnnotationEmbeddable has a Context, but the members (the merged in Xml-attributes) have a different context. (Do not understand why there are two contexts, can you enlighten me?)
In the ClassWriter line 107
for ( MetaAttribute metaMember : members ) {
pw.println( " " + metaMember.getDeclarationString() );
}
the declaration string is printed. As the attributes are XMLMetaAttribute, their implementation of the getDeclarationString is
return "public static volatile " + hostingEntity.importType( getMetaType() )
+ "<" + hostingEntity.importType( hostingEntity.getQualifiedName() )
+ ", " + hostingEntity.importType( getTypeDeclaration() )
+ "> " + getPropertyName() + ";";
The hosting entity of the attribute is still the XmlMetaEmbeddable and when the importType is added, it is added to the wrong context (the context of the XMLMetaEmbeddable and NOT the AnnotationMetaEmbeddable).
Possible solution is to change the parent or create a new merged attribute (not ugly like I do below ;-))
MetaAttribute mergedAttribute = new XmlMetaSingleAttribute(this, attribute.getPropertyName(), attribute.getMetaType());
members.put( attribute.getPropertyName(), mergedAttribute );
This resolves the problem with the missing import, but if it is better to have a single context for both annotation and xml elements this might be a cleaner solution. Attached is the 'ugly' solution, but this leaves two failing testcases:
testAccessTypeForXmlConfiguredEmbeddables(org.hibernate.jpamodelgen.test.mixedmode.MixedConfigurationTest)
testMixedConfiguration(org.hibernate.jpamodelgen.test.mixedmode.MixedConfigurationTest)
The testMixedConfiguration could be a problem that the supplied solution is not yet the definitive answer ;-(:
=======================================================
Types do not match: Wrong meta model type expected:<class org.hibernate.jpamodelgen.test.mixedmode.RentalCompany> but was:<interface javax.persistence.metamodel.SingularAttribute>
org.testng.Assert.fail(Assert.java:84)
at org.testng.Assert.failNotEquals(Assert.java:438)
at org.testng.Assert.assertEquals(Assert.java:108)
at org.hibernate.jpamodelgen.test.util.TestUtil.assertAttributeTypeInMetaModelFor(TestUtil.java:176)
at org.hibernate.jpamodelgen.test.mixedmode.MixedConfigurationTest.testMixedConfiguration(MixedConfigurationTest.java:68)
30 lines not shown
=======================================================
The testAccessTypeForXmlConfiguredEmbbedables seems unreleated:
assertAbsenceOfFieldInMetamodelFor(
ZeroCoordinates.class,
"longitude",
"Field access should be used, but ZeroCoordinates does not define fields"
);
assertAbsenceOfFieldInMetamodelFor(
ZeroCoordinates.class,
"latitude",
"Field access should be used, but ZeroCoordinates does not define fields"
);
as I am not completely sure that the asserts are correct. The access type of embeddables dependends on the enclosing entity, so ain't it true that the field AND properties should be generated?
Regards,
Martijn
--
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
13 years
[Hibernate-JIRA] Created: (HHH-5659) Problem using Hibernate3.6.0.Final with CLOB field in Oracle.
by Samuel Rettore (JIRA)
Problem using Hibernate3.6.0.Final with CLOB field in Oracle.
-------------------------------------------------------------
Key: HHH-5659
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5659
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.0
Environment: Hibernate 3.6.0.Final, Database Oracle10G on Linux X64, and JPA
Reporter: Samuel Rettore
Priority: Minor
When migrating my project that works well with Hibernate 3.5.6 End-to 3.6.0.Final the Clob field displays the following error
|java.lang.ClassCastException: $Proxy1119 cannot be cast to oracle.sql.CLOB
at oracle.jdbc.driver.OraclePreparedStatement.setClob(OraclePreparedStatement.java:7021)
at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1.doBind(ClobTypeDescriptor.java:60)
at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:89)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:282)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:277)
at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:85)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2166)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2412)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2856)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:795)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.flush(EntityManagerWrapper.java:407)
---
This error appears only with CLOB field.
to get more information at their disposal.
Thanks
Rettore.
--
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
13 years
[Hibernate-JIRA] Created: (HHH-6902) Create typed query in EntityManager throws NullPointerException when filters are present
by Dan Luca (JIRA)
Create typed query in EntityManager throws NullPointerException when filters are present
----------------------------------------------------------------------------------------
Key: HHH-6902
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6902
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Final
Environment: Oracle 11g; HibernateCore 4.0.0.Final; Spring 3.1.0
Reporter: Dan Luca
I have an environment with JPA annotated entities, some with filters - e.g. filter out logically deleted entities. I have upgraded to hibernate 4 and discovered that {{javax.persistence.EntityManager.createQuery(String, Class<T>)}} throws a {color: red}NullPointerException{color} every time is invoked.
I did some digging and here is what I have found:
* calling {{entityManager.createQuery("query", resultType)}} on the current entity manager, ends up at {{org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(String, Class<T>)}}
* this method does two things:
*# creates the actual HQL query
*# performs validation of the result type
* step 2 above has the following call
{code:title=AbstractEntityManagerImpl}
final HQLQueryPlan queryPlan = unwrap( SessionImplementor.class )
.getFactory()
.getQueryPlanCache()
.getHQLQueryPlan( jpaqlString, false, null );
{code}
Note the third argument in the {{QueryPlanCache.getHQLQueryPlan(String, boolean, Map)}} call is null. This argument is a raw +Map+ of enabled filters.
* {{org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(String, boolean, Map)}} implementation creates a cache key from {color:navy}(queryString, shallowFlag, enabledFilters){color} tuple and if a plan exists it uses it, otherwise creates a brand new plan by invoking its constructor: {{new HQLQueryPlan(queryString, shallow, enabledFilters, factory )}}
** Note that the key created by step 1 above when there are filters defined, is +different+ from the one created with {{enabledFilters}} set to empty or null
* the HQLQueryPlan constructor invokes *{color:red}{{enabledFilters.keySet()}}{color}* - hence the NPE
I believe the correct invocation of the {{getHQLQueryPlan()}} at step 2 - for the purposes of validation - should be something like this instead:
{{.getHQLQueryPlan( jpaqlString, false, *Collections.emptyMap())*}}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (HHH-6593) Fetch joining subelements of a one-to-one or many-to-one association
by Christian Beikov (JIRA)
Fetch joining subelements of a one-to-one or many-to-one association
--------------------------------------------------------------------
Key: HHH-6593
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6593
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.6
Reporter: Christian Beikov
Priority: Critical
The problem is discussed on the forum a long time ago. I just found the topic and i wanted to report that this bug is still available in 3.6.6
https://forum.hibernate.org/viewtopic.php?f=1&t=987905&start=0
Here a concrete example from my usecase:
class A{
private B b;
}
class B{
private Map<String, C> map;
}
class C{
private String c;
}
Just imagine that the classes and fields would be annotated right ;)
Now the problem in my case was that i wanted a list of A elements with fetch joined B and of course it's map.
I tried the following query:
FROM A a LEFT OUTER JOIN FETCH a.b bElem LEFT OUTER JOIN bElem.map cMap
and i got a NullPointerException just like the users which posted in the given topic.
My workaround was:
FROM A a LEFT OUTER JOIN FETCH a.b bElem LEFT OUTER JOIN a.b.map cMap
The main problem now is, that i have a dynamic fetch profile system which won't work correctly if this issue is not solved.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (HHH-6695) Error "Cannot create TypedQuery for query with more than one return" with named queries
by Oliver Siegmar (JIRA)
Error "Cannot create TypedQuery for query with more than one return" with named queries
---------------------------------------------------------------------------------------
Key: HHH-6695
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6695
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 4.0.0.CR4, 3.6.7, 3.6.8
Reporter: Oliver Siegmar
The already closed issues HHH-5348 and HHH-6591 only fixed the bug with standard (non-named) queries. Having a query like {code:sql}SELECT NEW org.test.MyClass( 'Foo', 123 ) FROM IrcEvent ev{code} as shown in HHH-6591 used by createQuery(), the bug has been fixed. Using the very same query as a named query by createNamedQuery() this exception is thrown:
{noformat}
java.lang.IllegalArgumentException: Cannot create TypedQuery for query with more than one return
at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:684) ~[hibernate-entitymanager-4.0.0-20110929.060732-144.jar:4.0.0-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0]
...
{noformat}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years