[Hibernate-JIRA] Created: (HHH-2617) Warning on tables with inheritance when table defaults are set in entity-mappings
by Stephen Todd (JIRA)
Warning on tables with inheritance when table defaults are set in entity-mappings
---------------------------------------------------------------------------------
Key: HHH-2617
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2617
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.2
Environment: Using Annotations
Reporter: Stephen Todd
Priority: Trivial
Attachments: inheritance-orm.xml, TestSingleTableInheritanceWarnings.java
The following warning message is logged when entity-mapping defaults are set and tables with inheritance are present:
Illegal use of @Table in a subclass of a SINGLE_TABLE hierarchy: class.name.Here
I attached a test case that recreates the problem. Basically, the error occurs when a resource contains persistence-unit-defaults. It appears that hibernate creates an @Table attribute for every registered entity when I think it should only do it for non-single table inheritance entities. Below is an example of the orm.xml
<entity-mappings>
<persistence-unit-metadata>
<persistence-unit-defaults>
<catalog>public</catalog>
</persistence-unit-defaults>
</persistence-unit-metadata>
<entity class="hibernatebugs.TestAnnotationWarnings$ParentEntity">
<inheritance strategy="SINGLE_TABLE"/>
</entity>
</entity-mappings>
Test requires EasyMock and Log4J.
--
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
16 years, 10 months
[Hibernate-JIRA] Created: (HHH-2073) many-to-one join fetch with optional parent causing stray query to fire
by Adam Hardy (JIRA)
many-to-one join fetch with optional parent causing stray query to fire
-----------------------------------------------------------------------
Key: HHH-2073
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2073
Project: Hibernate3
Type: Bug
Reporter: Adam Hardy
Priority: Minor
Attachments: bugtest.zip
I have a call centre application which uses a mature database and is therefore pushing Hibernate to accomplish the mappings I need. The issue here is extra queries that Hibernate is firing where I set up the mapping to do a join in one hit.
I am fetching child objects which may or may not have a parent. The child's foreign key points to a non-primary key on the parent. This is not reflected by a foreign key constraint in the database (hence it allows child to have no parent).
If the child object has the foreign key 0 instead of null, which is the protocol in this database, then the parent which doesn't exist is not (& cannot) be instantiated, no problem, but then after processing the resultset, Hibernate fires off another query to fetch the parent that it could not find data for in the first query.
This is obviously unnecessary in this context and degrades the performance on large searches on this child.
I have classified it as minor since I suspect there may be work-arounds but I have not researched that yet.
I didn't know whether I could put the mapping XML in the query, so I have attached a simplistic testcase example that demonstrates the problem.
The following forum messages are relevant and the latter contains the mappings, which is easier than extracting them out of the testcase zip:
http://forum.hibernate.org/viewtopic.php?t=960522
http://forum.hibernate.org/viewtopic.php?t=964211
--
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
16 years, 10 months
[Hibernate-JIRA] Created: (HHH-2664) full join not working
by Fabio Tudone (JIRA)
full join not working
---------------------
Key: HHH-2664
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2664
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.4, 3.1.2
Environment: Any DB, tested on Windows
Reporter: Fabio Tudone
Attachments: test.jar
I get this error when trying to full join:
- an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: undefined join type 23
at org.hibernate.hql.ast.util.JoinProcessor.toHibernateJoinType(JoinProcessor.java:68)
at org.hibernate.hql.ast.HqlSqlWalker.setImpliedJoinType(HqlSqlWalker.java:433)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3157)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3067)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at com.finantix.test.Main.main(Main.java:63)
--
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
16 years, 10 months
[Hibernate-JIRA] Created: (ANN-653) Exception when unidirection OneToMany relation defined in Embeded class
by Jifeng Liu (JIRA)
Exception when unidirection OneToMany relation defined in Embeded class
-----------------------------------------------------------------------
Key: ANN-653
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-653
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Environment: Hibernate Core 3.2.5.ga
Hibernate Annotations 3.3.0 GA
Hibernate EntityManager 3.3.1 GA
Reporter: Jifeng Liu
Attachments: src.zip
I got the following exception when I run the test case in attach file. It seems Hibernate throws Exception when unidirection OneToMany relation defined in Embeded class.
Exception in thread "main" org.hibernate.AnnotationException: Illegal attempt to define a @JoinColumn with a mappedBy as
sociation: htmlText.images
at org.hibernate.cfg.Ejb3JoinColumn.buildJoinColumn(Ejb3JoinColumn.java:152)
at org.hibernate.cfg.Ejb3JoinColumn.buildJoinColumns(Ejb3JoinColumn.java:127)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1178)
at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:1731)
at org.hibernate.cfg.AnnotationBinder.bindComponent(AnnotationBinder.java:1665)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1544)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:706)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:137)
at test.Test.run(Test.java:24)
at test.Test.main(Test.java:20)
--
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
16 years, 10 months
[Hibernate-JIRA] Created: (EJB-295) mapping-file orm.xml not included
by Georges-Etienne Legendre (JIRA)
mapping-file orm.xml not included
---------------------------------
Key: EJB-295
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-295
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Environment: Hibernate Core 3.2.4.GA
Hibernate EntityManager 3.3.1.GA
Reporter: Georges-Etienne Legendre
We have the following situation: A jar library for our entity classes has been created. In it, there are these two files in the META-INF directory: persistence.xml and orm.xml. We define some common queries in the orm.xml file.
This library is then used in another project. Because we would like to define other more specialized named queries in this project, we assumed that another orm.xml file (in the META-INF directoty) could be used. Without any workaround, it doesn't work. The entity manager only find/use the orm.xml contained in the library. To make it works, we have to add these 2 lines in the persistence.xml :
<mapping-file>/META-INF/orm.xml</mapping-file>
<mapping-file>/META-INF/orm.xml</mapping-file>
The entity manager then includes both orm.xml files.
In JSR 220, chapter 6.2.1.6, it's said: "... A object/relational mapping XML file named orm.xml may be specified in the META-INF directory in the root of the persistence unit or in the META-INF directory of any jar file referenced by the persistence. xml. Alternatively, or in addition, other mapping files may be referenced by the mapping-file elements of the persistence-unit element, and may be present anywhere on the class path."
--
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
16 years, 10 months