[Hibernate-JIRA] Created: (HHH-3158) PersistentList.getDeletes issue when used with @OneToMany and @IndexColumn
by Hao Chen (JIRA)
PersistentList.getDeletes issue when used with @OneToMany and @IndexColumn
--------------------------------------------------------------------------
Key: HHH-3158
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3158
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.2
Reporter: Hao Chen
I have the following scenario:
class Parent {
@OneToMany(cascade={CascadeType.ALL})
@IndexColumn(name="position", base=1)
private List<Children> children;
}
And I am getting MySQL constraint error: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '332' for key 2
The reason for the exception is that Hibernate generated association table has:
table parent_children:
parent_id
children_id unique --- this causes duplicate key error
position
I have tracked this down, and it looks like PersistentList.getDeletes is not returning the correct index to be deleted:
suppose: oldChildren siize is 3 and the association table is:
parent_id=1, children_id=1, position=1;
parent_id=1, children_id=2, position=2;
parent_id=1, children_id=3, position=3;
now I delete the first child: because getDeletes only use size to decide which one in the list to be deleted, it will return {2} because it assumes the last item is deleted.
so, the 3rd child is deleted from the association table. There is still two rows in the association table:
parent_id=1, children_id=1, position=1;
parent_id=1, children_id=2, position=2;
now, because child 2 is at position 1 now, Hibernate try to update position=1 to: parent_id=1, children_id=2, but children_id already exists at row 2. Thus the MySQLIntegrityConstraintViolationException is throw.
I think the PersistentList.getDeletes should do the same thing as PersistentBag.getDeletes, which compare each element in the list to the snapshot list to decide which elements to delete.
--
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, 9 months
[Hibernate-JIRA] Created: (ANN-591) SchemaExport throws ConcurrentModificationException for entity containing list of lists
by Ivan O'Connor (JIRA)
SchemaExport throws ConcurrentModificationException for entity containing list of lists
---------------------------------------------------------------------------------------
Key: ANN-591
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-591
Project: Hibernate Annotations
Issue Type: Bug
Components: binder
Affects Versions: 3.2.1
Environment: Hibernate 3.2.1.GA, Oracle 10
Reporter: Ivan O'Connor
Attachments: hbm2ddl.zip
I have a class, let's call it A, that contains a List of class B. Each instance of B has a List of class C. I'm trying to generate the DDL for this, so I've annotated the code and run it through SchemaExport, which throws a ConcurrentModificationException. My environment: Java 1.5, Oracle 10, Hibernate 3.2.1ga.
The problem seems to be caused by having an entity (A) containing an embedded collection (of B), each element of which contains a collection (of C). SchemaExport generates correct DDL when the annotations are modified to make B and/or C an entity, but not when they are both components. I realise this is considered something of an exotic case, but I'd like to know why the DDL doesn't generate.
See bugReport.txt in attached zip for further details.
--
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, 9 months
[Hibernate-JIRA] Commented: (HHH-1829) Allow join on any property using property-ref
by Mathias Neuner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829?page=c... ]
Mathias Neuner commented on HHH-1829:
-------------------------------------
doesn't seem to be fixed in 3.2.6ga. when will it be fixed?
> Allow join on any property using property-ref
> ---------------------------------------------
>
> Key: HHH-1829
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829
> Project: Hibernate3
> Issue Type: New Feature
> Components: metamodel
> Affects Versions: 3.2.0 cr1, 3.2.0.cr2
> Reporter: Maarten Winkels
> Assignee: Steve Ebersole
> Attachments: AbstractJoinTest.java, 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
16 years, 9 months
[Hibernate-JIRA] Commented: (HHH-1503) NPE
by Vincent Ricard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1503?page=c... ]
Vincent Ricard commented on HHH-1503:
-------------------------------------
This bug seems fixed since the method code is:
public void releaseBorrowedConnection() {
if ( borrowedConnection != null ) {
try {
BorrowedConnectionProxy.renderUnuseable( borrowedConnection );
}
finally {
borrowedConnection = null;
}
}
}
> NPE
> ---
>
> Key: HHH-1503
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1503
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1.2
> Reporter: Igor I Nikonoff
> Priority: Minor
>
> ConnectionManager.java releaseBorrowedConnection method NEED FIX
> public void releaseBorrowedConnection() {
> if ( borrowedConnection != null ) {
> BorrowedConnectionProxy.renderUnuseable( borrowedConnection );
> borrowedConnection = null;
> }
> }
> because in BorrowedConnectionProxy.renderUnuseable method following check to not null borrowedConnection.
> PS. orig method is:
> public void releaseBorrowedConnection() {
> if ( borrowedConnection != null ) {
> borrowedConnection = null;
> BorrowedConnectionProxy.renderUnuseable( borrowedConnection );
> }
> }
--
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, 9 months
[Hibernate-JIRA] Commented: (HBX-662) Classes in linked folders are not found
by Dmitry Geraskov (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-662?page=co... ]
Dmitry Geraskov commented on HBX-662:
-------------------------------------
Mark, I tried to do the same things you spoke about.
1) Create 2 projects: consoleProject, classesProject.
2) in classesProject create class mapping\A.java and mapping\A.hbm.xml (with mapping)
3) for classesProject : Project Properties->"Java Build Path"->"Default output folder"->"Browse"->"Create new folder"->"Advanced"
4) type d:\temp and press OK while Properties wizard not closed.
=> if project not builded automatically build it
=> observe that mapping\A.java and mapping\A.hbm.xml in "d:\temp" folder.
(I didn't see nothing there at first time and repeated step 2 and 3 with other folder names.)
5) for consoleProject: create new Console Configuration "configForConsoleProject"
6) add your DB driver to classpath
7) add <mapping resource ="mapping\A.hbm.xml"> to hibernate.cfg.xml (or as mapping when create console configuration)
8) edit "configForConsoleProject": ->Classpath->Advanced-> 'add external folder" and add "d:\temp " to classpath.
9) rebuild "configForConsoleProject"
==> now it should work without mapping exception.
BTW I didn't understand why you have error there, so please answer if you still have it.
Dmitry.
> Classes in linked folders are not found
> ---------------------------------------
>
> Key: HBX-662
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-662
> Project: Hibernate Tools
> Issue Type: Bug
> Components: eclipse
> Affects Versions: 3.1.beta5
> Environment: Eclipse 3.1.1, JDK 1.4
> Reporter: Mark
> Priority: Minor
> Fix For: 3.2.1
>
>
> "Hibernate Configurations" widget shows class not found for classes that are linked to an external directory.
> By External directory I mean a directory that is set as build location by using the "Link to folder in the file system" under Project Properties->"Java Build Path"->"Default output folder"->"Browse"->"Create new folder"->"Advanced"
> I can pick this path in the "Hibernate Console Configuration"->"Add JAR/Dir", but the class is not picked up.
> When I move the build directory to a directory that is physically located inside the Eclipse project tree it works.
> MARK
--
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, 9 months
[Hibernate-JIRA] Created: (HHH-3156) NamingStrategy sometimes not work
by Krashan Brahmanjara (JIRA)
NamingStrategy sometimes not work
---------------------------------
Key: HHH-3156
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3156
Project: Hibernate3
Issue Type: Bug
Environment: 3.2.6ga
Reporter: Krashan Brahmanjara
I just run standard junit test from Hibernate 3.2.6ga for Informix database and see many failed tests.
I saw there few problems.
- adding to junit TectCase.java line with ImprovedNamingStrategy seems to not work. Behaviour not changed.
Especially for org.hibernate.test.sql.hand.query.NativeSQLQueriesTest
I don't see any other place to make this settings. Would be great to do it in configuration file (HBX-612)
code
TestCase.cfg = new Configuration();
+ cfg.setNamingStrategy(ImprovedNamingStrategy.INSTANCE);
After some test I see also that
- native SQL queries are not converted with NamingStrategy rules in Session.createSQLQuery
- databases export/import not read NamingStrategy from configuration. It only read default values from configuration.
The problem exists in folder hbm2ddl and file SchemaExportTask etc. in lines :
Configuration cfg = new Configuration();
if (namingStrategy!=null) {
cfg.setNamingStrategy(
If user set new strategy in session then SchemaExport don't see that.
At this moment one good method to succesfully change NamingStrategy for all classes is manual modification of Configuration.java file ... I know it's stupid idea.
--
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, 9 months
[Hibernate-JIRA] Commented: (HHH-1895) HqlSqlWalker throws NullPointerException with explicit joins and component mapping
by Gilliard Santos Cordeiro (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1895?page=c... ]
Gilliard Santos Cordeiro commented on HHH-1895:
-----------------------------------------------
I have the same problem!
> HqlSqlWalker throws NullPointerException with explicit joins and component mapping
> ----------------------------------------------------------------------------------
>
> Key: HHH-1895
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1895
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1.3
> Environment: Oracle 9i, Hibernate 3.1.3
> Reporter: Victor Suarez
> Priority: Minor
>
> HqlSqlWalker throws a NPE if a explicit join is used with fields that are mapped with component mapping. If explicit join is removed and implicit join is used, the HQL works fine. This kind of problem didn't occur with Hibernate2.
> Examples (hbm below):
> The query:
> String query = "FROM " + Pais.class.getName() + " AS pais JOIN pais.metaInfo AS minfo WHERE minfo.activo = true";
> fails with this stacktrace:
> Exception in thread "main" java.lang.NullPointerException
> at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:317)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3268)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3060)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2938)
> 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:218)
> at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
> at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
> at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> 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:1583)
> This one works fine:
> String query = "FROM " + Pais.class.getName() + " AS pais WHERE pais.metaInfo.activo = true";
> With this behaviour, HQL seems not to be totally transparent to mappings.
> Mapping file:
> <hibernate-mapping>
> <class name="Pais" table="Paises" lazy="true">
> <id name="id" type="long" column="id">
> <generator class="increment"/>
> </id>
> <component name="metaInfo" class="MetaInfo">
> <property name="usuarioAlta" column="usuarioAltaMetaInfo" type="string" not-null="false"/>
> <property name="fechaBaja" column="fechaBajaMetaInfo" type="timestamp" not-null="false"/>
> <property name="fechaAlta" column="fechaAltaMetaInfo" type="timestamp" not-null="false"/>
> <property name="activo" column="activoMetaInfo" type="boolean" not-null="false"/>
> <property name="usuarioBaja" column="usuarioBajaMetaInfo" type="string" not-null="false"/>
> </component>
> <property name="nombre" column="nombre" type="string" not-null="true"/>
> <property name="codigo" column="codigo" type="string" not-null="false"/>
>
> <set name="localidades" access="field" inverse="true"
> cascade="all-delete-orphan" lazy="true" batch-size="5">
> <key column="pais" />
> <one-to-many class="Localidad"/>
> </set>
> <set name="provincias" access="field" inverse="true"
> cascade="all-delete-orphan" lazy="true" batch-size="5">
> <key column="pais" />
> <one-to-many class="Provincia"/>
> </set>
>
> <property name="codAS400" type="string" not-null="false"/>
> </class>
> </hibernate-mapping>
--
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, 9 months
[Hibernate-JIRA] Created: (ANN-590) Table name problem
by Eddie Man (JIRA)
Table name problem
------------------
Key: ANN-590
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-590
Project: Hibernate Annotations
Issue Type: Bug
Components: binder
Affects Versions: 3.2.1
Reporter: Eddie Man
Priority: Critical
Attachments: src.zip
Problem:
When I run the test.Main in the attachment, an mapping exception thrown while passing the annotation:
Exception in thread "main" org.hibernate.MappingException: Unable to find column with logical name: customerID in ShoppingBasket
at org.hibernate.cfg.Ejb3JoinColumn.checkReferencedColumnsType(Ejb3JoinColumn.java:383)
at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:88)
at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:63)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:428)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:286)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
at test.Main.main(Main.java:19)
But when I change the table name of ShoppingBaskets to "Basket", then the problem solved.
--
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, 9 months