[Hibernate-JIRA] Created: (HHH-3798) failure to lazy load a manyToOne and oneToMany mapped entity
by Ronald Kurz (JIRA)
failure to lazy load a manyToOne and oneToMany mapped entity
------------------------------------------------------------
Key: HHH-3798
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3798
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1, 3.5
Environment: hibernate annotations test case, maven profile hsqldb, svn rev 16079
hibernate-core 3.3.1.GA, JBoss 4.2.3, SQLServer 2000
Reporter: Ronald Kurz
Attachments: test-case.tar.gz
Following situtation: an entity Data has Revision entities (oneToMany). Each Revision entity belongs to a Data entity. The Data entity has one manyToOne mapping to the current Revision. The mappings from Data to Revision are all lazy.
When loading a Data entity, which has two Revisions, the Revision entity which is also mapped as manyToOne (the current Revision for that Data entity), does not get loaded. It will be an uninitialized proxy, which is also resistent to Hibernate.initialize(<Data>.revision). The same proxy is also in the oneToMany mapped list.
@Entity
public class Data {
@Id @GeneratedValue
public int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "revisionId")
public Revision revision;
@OneToMany(mappedBy = "data")
public List<Revision> revisions = new ArrayList<Revision>();
}
@Entity
public class Revision {
@Id @GeneratedValue
public int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dataId", nullable = false, updatable = false)
public Data data;
public Integer number;
}
The test case is written for the hibernate-annotations project (simply because I never wrote a mapping using xml)
--
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, 6 months
[Hibernate-JIRA] Created: (HHH-3476) Generation of invalid SQL by HQL Delete
by Daniel Nunes (JIRA)
Generation of invalid SQL by HQL Delete
---------------------------------------
Key: HHH-3476
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3476
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.6, 3.1.3
Environment: MS SQL Server 2000, Hibernate 3.1.3 and Hibernate 3.2.6 GA
Reporter: Daniel Nunes
Attachments: grupo.rar, hibernate.cfg.xml
Hibernate generates invalid DML command for HQL Delete statement.
When doing:
Integer vals[] = {1,3};
Query q = ugDAO.createQuery("delete UsuarioGrupo usuariorGrp"+
" where usuariorGrp.usuario.idusuario = :idUsr"+
" and usuariorGrp.grupo.idgrupo in (:idsGrupo)"+
" and usuariorGrp.grupo.cxpostal.idcxpostal = :idCx");
q.setParameterList("idsGrupo", vals);
q.setInteger("idUsr", 77);
q.setInteger("idCx", 2);
It generates an SQL like this:
Hibernate: delete from vanpix.dbo.usuario_grupo, vanpix.dbo.grupo grupo1_ where idusuario=? and (idgrupo in (? , ?)) and idcxpostal=?
17:26:22,406 DEBUG IntegerType:133 - binding '77' to parameter: 1
17:26:22,406 DEBUG IntegerType:133 - binding '1' to parameter: 2
17:26:22,406 DEBUG IntegerType:133 - binding '3' to parameter: 3
17:26:22,406 DEBUG IntegerType:133 - binding '2' to parameter: 4
17:26:22,453 WARN JDBCExceptionReporter:77 - SQL Error: 170, SQLState: 37000
17:26:22,453 ERROR JDBCExceptionReporter:78 - Line 1: Incorrect syntax near ','.
Throwing the exception:
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute update query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:396)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1141)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
at com.pix.tests.HibernateTests.main(HibernateTests.java:37)
Caused by: java.sql.SQLException: Line 1: Incorrect syntax near ','.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:631)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedStatement.java:505)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)
... 5 more
The HBMs are in the attachment.
--
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, 6 months
[Hibernate-JIRA] Created: (HBX-1144) Weird Column Length problem - new length value in annotation being ignored
by Duncan Kinnear (JIRA)
Weird Column Length problem - new length value in annotation being ignored
--------------------------------------------------------------------------
Key: HBX-1144
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1144
Project: Hibernate Tools
Issue Type: Bug
Affects Versions: 3.2.0.GA
Environment: Tar file was hibernate-3.2.6.ga.tar. Glassfish version 2.0 ur2. PostgreSQL version 8.x (various)
Reporter: Duncan Kinnear
We are using Hibernate as our persistence layer with NetBeans 6.7.1, EJB3, Glassfish and PostgreSQL.
We have almost 200 tables defined as EJB entities. We use annotations on the entities to define the tables/columns. As we are still in an early testing phase, we regularly drop all the tables in the database and use the Hibernate auto schema update to recreate them.
Recently we changed the length of a standard field that appears in many of our tables. The column is called ID_ORDER and is defined in the entities using the following code:
@Column(name = "ID_ORDER", length = STANDARD_ID_ORDER_LENGTH, nullable = false)
private String idOrder;
where STANDARD_ID_ORDER_LENGTH is defined as a public static final int in the superclass of these tables.
This length used to be 20, but we increased this to 50, recompiled all the affected classes, dropped all the tables and redeployed.
Now, on 2 developer machines this change worked correctly, with the new tables having their ID_ORDER columns all length 50.
However, on the other 2 developer machines, one table (called FEED_TYPE) gets recreated with the ID_ORDER column with length 20. This also occurs when we deploy the resulting EAR file to another server running Glassfish.
We have tried all sorts of things on these machines to try and 'fix' this. We have removed the column completely, recreated the table and it is still there! We have explicitly set the length in the annotation of the column of this one table and the length is always ignored. We have renamed the existing column and deployed, but the new column is always length 20. We have renamed the table and then recreated it - still wrong. We have even dropped the entire database and recreated it, but the length of 20 remains!
We are pulling our hair out on this one, it just doesn't make any sense. Where is hibernate 'caching' the length definition of this one column in one table?
--
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, 6 months
[Hibernate-JIRA] Created: (HSEARCH-320) Hibernate Search conflicts with Spring's class path scanning
by Paul Middelkoop (JIRA)
Hibernate Search conflicts with Spring's class path scanning
------------------------------------------------------------
Key: HSEARCH-320
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-320
Project: Hibernate Search
Issue Type: Bug
Affects Versions: 3.1.0.GA, 3.1.0.CR1
Reporter: Paul Middelkoop
Hibernate Search conflicts with Spring's class path scanning. When Hibernate Search is on the classpath Spring throws an exception while reading annotation metadata.
3.1.0 Beta1 and 3.0.x versions had no problems.
Stacktrace:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 50432
at org.springframework.asm.ClassReader.readUTF8(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.core.type.classreading.SimpleMetadataReader.getAnnotationMetadata(SimpleMetadataReader.java:55)
at org.springframework.core.type.filter.AnnotationTypeFilter.matchSelf(AnnotationTypeFilter.java:68)
at org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilter.match(AbstractTypeHierarchyTraversingFilter.java:55)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.isCandidateComponent(ClassPathScanningCandidateComponentProvider.java:224)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:182)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:201)
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:85)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1255)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1245)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
--
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, 6 months