[Hibernate-JIRA] Created: (METAGEN-74) @Column(columnDefinition = ...) ignored unless placed by get method.
by jee4hire (JIRA)
@Column(columnDefinition = ...) ignored unless placed by get method.
--------------------------------------------------------------------
Key: METAGEN-74
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-74
Project: Hibernate Metamodel Generator
Issue Type: Bug
Environment: Linux omega 2.6.32-33-generic-pae #71-Ubuntu SMP Wed Jul 20 18:46:41 UTC 2011 i686 GNU/Linux
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
jboss-as-7.0.0.Final
mysql-connector-java-5.1.15.jar
mysql-server-5.1 (5.1.41-3ubuntu12.10)
Reporter: jee4hire
Assignee: Hardy Ferentschik
>>>Not working: @Column is placed with variable definition.
Column data is created in database as type tinyblob.
Thus, @Column(columnDefinition = "blob") is ignored.
@Entity
public class File implements Serializable {
private Long id;
@NotNull @Column(columnDefinition = "blob")
private byte [] data;
@Id @GeneratedValue
public Long getId() { return id; }
public void setId(Long i) { id = i; }
public byte [] getData() { return data; }
public void setData(byte [] d) { data = d; }
}
##############################################################################
>>>Workaround: @Column is placed with get method.
Then, column data is created in database as type blob.
@Entity
public class File implements Serializable {
private Long id;
private byte [] data;
@Id @GeneratedValue
public Long getId() { return id; }
public void setId(Long i) { id = i; }
@NotNull @Column(columnDefinition = "blob")
public byte [] getData() { return data; }
public void setData(byte [] d) { data = d; }
}
##############################################################################
Excerpt from: jboss-as-7.0.0.Final/standalone/configuration/standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/MySqlDS" pool-name="MySqlDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>
jdbc:mysql://localhost:3306/jboss
</connection-url>
<driver>
com.mysql
</driver>
<transaction-isolation>
TRANSACTION_READ_COMMITTED
</transaction-isolation>
<pool>
<min-pool-size>
10
</min-pool-size>
<max-pool-size>
100
</max-pool-size>
<prefill>
true
</prefill>
<use-strict-min>
false
</use-strict-min>
<flush-strategy>
FailingConnectionOnly
</flush-strategy>
</pool>
<security>
<user-name>
*************
</user-name>
<password>
*************
</password>
</security>
<statement>
<prepared-statement-cache-size>
32
</prepared-statement-cache-size>
<share-prepared-statements/>
</statement>
</datasource>
<drivers>
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
</xa-datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>
org.h2.jdbcx.JdbcDataSource
</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
##############################################################################
war jars:
61504 Defl:N 56482 8% 2011-07-21 10:31 92d0520b WEB-INF/lib/i18nlog-1.0.10.jar
358085 Defl:N 324832 9% 2011-04-04 11:37 8c574f28 WEB-INF/lib/log4j-1.2.12.jar
47399 Defl:N 41460 13% 2011-07-21 10:31 ac044dbb WEB-INF/lib/jboss-logging-3.0.0.Beta5.jar
204093 Defl:N 181695 11% 2011-07-07 12:54 ed9a2ff2 WEB-INF/lib/picketlink-idm-core-1.5.0.Alpha02.jar
55966 Defl:N 44907 20% 2011-07-07 12:54 d81b0cc2 WEB-INF/lib/seam-international-3.0.0.Final.jar
529064 Defl:N 490198 7% 2011-07-18 14:13 cb9a1aec WEB-INF/lib/quartz-2.0.1.jar
1627515 Defl:N 1470306 10% 2011-07-07 12:54 e71d8ef4 WEB-INF/lib/primefaces-3.0.M2.jar
231287 Defl:N 203688 12% 2011-07-21 10:31 76154858 WEB-INF/lib/jboss-marshalling-1.3.0.CR9.jar
2479225 Defl:N 2249049 9% 2011-08-03 07:41 f775e5eb WEB-INF/lib/richfaces-components-ui-4.1.0-20110802.221239-82.jar
543011 Defl:N 456324 16% 2011-07-12 14:02 f915bdef WEB-INF/lib/joda-time-1.6.1.jar
80863 Defl:N 74890 7% 2011-07-21 10:31 1074f519 WEB-INF/lib/jboss-marshalling-river-1.3.0.CR9.jar
153633 Defl:N 139858 9% 2011-07-18 08:58 267a0105 WEB-INF/lib/seam-security-impl-3.0.1-20110624.041853-12.jar
546379 Defl:N 489412 10% 2011-07-21 10:38 7810d5c7 WEB-INF/lib/jboss-common-core-2.2.17.GA.jar
161455 Defl:N 122304 24% 2011-07-12 15:10 55c0bc93 WEB-INF/lib/knowledge-api-5.2.0.Final.jar
1902276 Defl:N 1719856 10% 2011-07-12 15:10 91eaa4f6 WEB-INF/lib/drools-core-5.2.0.Final.jar
15071 Defl:N 12479 17% 2011-04-04 11:31 a1e02acb WEB-INF/lib/jta-1.1.jar
7635 Defl:N 5428 29% 2011-07-21 10:31 ed71d5ec WEB-INF/lib/rhq-pluginAnnotations-3.0.1.jar
897071 Defl:N 858346 4% 2011-07-12 15:16 a1635c95 WEB-INF/lib/antlr-3.3.jar
91540 Defl:N 81205 11% 2011-07-25 08:27 6d5bdd9e WEB-INF/lib/seam-config-xml-3.0.1-20110723.041850-8.jar
443432 Defl:N 420698 5% 2011-05-16 12:02 d108cdd2 WEB-INF/lib/antlr-2.7.6.jar
1674737 Defl:N 1601274 4% 2011-07-07 12:55 b5de0b5f WEB-INF/lib/ecj-3.5.1.jar
10899 Defl:N 7710 29% 2011-07-21 10:31 b580639d WEB-INF/lib/jboss-transaction-api-1.0.1.GA.jar
15808 Defl:N 12066 24% 2011-07-07 12:54 cbb7cd31 WEB-INF/lib/sac-1.3.jar
269014 Defl:N 245020 9% 2011-06-20 14:42 0d19c92a WEB-INF/lib/commons-net-3.0.1.jar
1472606 Defl:N 1320427 10% 2011-07-21 10:31 0084c472 WEB-INF/lib/infinispan-core-5.0.0.CR7.jar
7457 Defl:N 5972 20% 2011-07-18 14:13 cdac3310 WEB-INF/lib/quartz-jboss-2.0.1.jar
713433 Defl:N 657365 8% 2011-07-12 15:10 3e88a598 WEB-INF/lib/mvel2-2.1.0.drools2.jar
12623 Defl:N 10267 19% 2011-07-21 10:38 77d0c4ba WEB-INF/lib/jboss-logging-spi-2.1.0.GA.jar
253950 Defl:N 241386 5% 2011-05-12 11:27 f758d70e WEB-INF/lib/cssparser-0.9.5.jar
1114265 Defl:N 987976 11% 2011-05-12 11:27 57d773f1 WEB-INF/lib/guava-r08.jar
25496 Defl:N 22183 13% 2011-07-14 12:55 1a95d60b WEB-INF/lib/slf4j-api-1.6.1.jar
85262 Defl:N 64318 25% 2011-08-03 07:41 09f14670 WEB-INF/lib/richfaces-components-api-4.1.0-20110802.221059-82.jar
119223 Defl:N 103690 13% 2011-07-18 08:58 fb1581b3 WEB-INF/lib/seam-persistence-3.0.1-20110711.040751-17.jar
148627 Defl:N 138829 7% 2011-07-12 15:16 3e8b388d WEB-INF/lib/stringtemplate-3.2.1.jar
397907 Defl:N 343667 14% 2011-07-07 12:54 7f34b227 WEB-INF/lib/seam-solder-3.0.0.Final.jar
102661 Defl:N 80043 22% 2011-07-07 12:54 b67dd2a4 WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
2135793 Defl:N 2028099 5% 2011-07-21 10:31 ade69d61 WEB-INF/lib/jgroups-2.12.0.Final.jar
988489 Defl:N 902079 9% 2011-07-12 15:16 22c8db9d WEB-INF/lib/drools-compiler-5.2.0.Final.jar
424253 Defl:N 391533 8% 2011-08-04 07:24 9a1f5dba WEB-INF/lib/richfaces-core-impl-4.1.0-20110803.165959-73.jar
83291 Defl:N 68465 18% 2011-08-03 07:41 d9920651 WEB-INF/lib/seam-servlet-3.0.1-20110803.040537-7.jar
33716 Defl:N 23689 30% 2011-07-18 08:58 3a591eab WEB-INF/lib/seam-security-api-3.0.1-20110624.041806-12.jar
163650 Defl:N 149460 9% 2011-07-12 15:16 e8acd98f WEB-INF/lib/antlr-runtime-3.3.jar
136498 Defl:N 115026 16% 2011-08-04 07:24 010242c6 WEB-INF/lib/richfaces-core-api-4.1.0-20110803.165751-75.jar
608376 Defl:N 554163 9% 2011-07-14 12:55 4bb8e85b WEB-INF/lib/c3p0-0.9.1.1.jar
23055 Defl:N 14694 36% 2011-07-07 12:54 5dfcdff2 WEB-INF/lib/picketlink-idm-spi-1.5.0.Alpha02.jar
27714 Defl:N 18846 32% 2011-07-07 12:54 9718b1ca WEB-INF/lib/picketlink-idm-api-1.5.0.Alpha02.jar
25717 Defl:N 20670 20% 2011-07-07 12:54 8473b909 WEB-INF/lib/picketlink-idm-common-1.5.0.Alpha02.jar
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-6997) Acquiring a lock on merging an entity
by Vincent MATHON (JIRA)
Acquiring a lock on merging an entity
-------------------------------------
Key: HHH-6997
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6997
Project: Hibernate ORM
Issue Type: New Feature
Components: core
Affects Versions: 4.0.1
Environment: DB2, Linux, JPA 2, JDK 1.6_29
Reporter: Vincent MATHON
I would like to acquire a pessimistic lock after a merge:
public T makePersistent(T entity, boolean lock) {
T mergedEntity = getEntityManager().merge(entity);
if (lock) {
em.flush();// sadly enough, this is necessary in case of insert
em.lock(mergedEntity, javax.persistence.LockModeType.PESSIMISTIC_READ);
}
return mergedObject;
}
I must trigger a flush to avoid an OptimisticLockException (similar to https://hibernate.onjira.com/browse/HHH-4177) if the entity does not exist yet in database..
It is pity that JPA does not allow for locking in the merge method signature... Couldn't Hibernate be smart enough to not throw any exception in the lock method, nor try to select for update if the mergedEntity is flagged as an entity to insert ?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-6914) SQL Server: Query with limit fails for HQL with ORDER BY over select clause alias
by Piotr Findeisen (JIRA)
SQL Server: Query with limit fails for HQL with ORDER BY over select clause alias
---------------------------------------------------------------------------------
Key: HHH-6914
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6914
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.7
Environment: MS SQL Server 2008
Reporter: Piotr Findeisen
If the HQL like:
{code}
SELECT u.id AS id, u.login AS login FROM User u
{code}
is executed with limit and offset, then {{SQLServer2008Dialect}} produces SQL like
{code}
WITH query AS (select ROW_NUMBER() OVER (order by col_1) as __hibernate_row_nr__, user.id as col_0, user.login as col_1 from users user ) SELECT * FROM query WHERE __hibernate_row_nr__ BETWEEN ? AND ?
{code}
This fails, as one select clause expression {{(select ROW_NUMBER() OVER (order by col_1) as __hibernate_row_nr__}} refers to another useing {{col_1}} alias.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Updated: (HHH-1928) order-by mapping for collections overrides order by in Criteria
by Gail Badner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1928?page=c... ]
Gail Badner updated HHH-1928:
-----------------------------
Affects Version/s: 3.6.9
> order-by mapping for collections overrides order by in Criteria
> ---------------------------------------------------------------
>
> Key: HHH-1928
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1928
> Project: Hibernate ORM
> Issue Type: Bug
> Components: query-criteria
> Affects Versions: 3.2.0.cr3, 3.6.9
> Reporter: Nguyen Hau Giang
> Attachments: testcase.zip
>
>
> relating to:
> HHH-594(order-by mapping for collections overrides order by in HQL)
> HHH-484(order-by not applied to collections fetched by OuterJoinLoader)
> Mapping(pseudo code):
> <class name="Master">
> <id name="id" />
> <set name="details" order-by="DISP_NO">
> <one-to-many class="Detail" />
> </set>
> </class>
> <class name="Detail">
> <id name="id" />
> <property name="dispNo" />
> <many-to-one name="master" class="Master" />
> </class>
> Same problem as in HHH-594, but instead of querying by HQL, when query by Criteria using join-fetch:
> session.createCriteria(Master.class)//
> .setFetchMode("details", FetchMode.JOIN)//
> .addOrder(Order.asc("id"))//
> .list();
> order-by mapping for collection overrides order by in Criteria:
> from
> Master this_
> left outer join
> Detail details2_
> on this_.id=details2_.ID
> order by
> details2_.DISP_NO,
> this_.id asc
> or when creating left-join alias:
> session.createCriteria(Master.class)//
> .createAlias("details", "D", Criteria.LEFT_JOIN)//
> .addOrder(Order.asc("id"))//
> .list();
> generated SQL:
> from
> Master this_
> left outer join
> Detail d1_
> on this_.id=d1_.ID
> order by
> d1_.DISP_NO,
> this_.id asc
> The order property specified in Criteria should be prior to order of collection mapping.
> I think this problem should be fixed as with HQL in HHH-594.
> For details, please see attached test case.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-6996) a little complex sql query returns wrong recordset, and the flush command executes a lot of queries I don't have execute ...
by Nestor Dubikin (JIRA)
a little complex sql query returns wrong recordset, and the flush command executes a lot of queries I don't have execute ...
----------------------------------------------------------------------------------------------------------------------------
Key: HHH-6996
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6996
Project: Hibernate ORM
Issue Type: Bug
Components: query-sql
Affects Versions: 3.6.8, 3.5.4
Environment: Ubuntu 11.10 - Eclipse Indigo 3.7.x - MySQL 5.1.54-1ubuntu4 - Java Sun JDK 1.6.0_24 / jdk 1.6.0_30
Testing with "show_sql">true and "format_sql">true
Reporter: Nestor Dubikin
Attachments: testErrorHibernateSQLQuery.rar
I execute a createSQLQuery select with 5 left join, last two over same table to obtain user_id and user name for 2 users.
I have 2 problems:
Problem 1: sql query executes and in 2 loaded fields in the record the data does not correspond with database field
Example wrong result with hibernate:
236, S21 - Pdte. Escanear convenio, df_demo, df_demo >>>> wrong retrieved data >>>> S21 - Pdte. Escanear convenio, S21 - Pdte. Escanear convenio
Example correct result whith jdbc:
214,S16 - Pdte. Borrador Convenio,df_demo,df_demo, >>>> correct retrieved data >>>> dfag demo,dfag demo
( pleas see attached test app )
Problem 2: I am executing only a sql select, but when tx.commit()s, hibernate¿? fire a set of deletes and insert that I can understand who is indicating this action.
This actions apparentely does not final effect in database because all deleted records are inserted newly, but I'm not peaceful with this ...
Please see attached word ( inside the .rar file )
Best regards,
Néstor Dubikin
skype: ndubikin
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-2052) org.hibernate.pretty.MessageHelper.collectionInfoString tries to cast wrong object to String, causes ClassCastException
by Tree 'Huggy Bear' Hugger (JIRA)
org.hibernate.pretty.MessageHelper.collectionInfoString tries to cast wrong object to String, causes ClassCastException
-----------------------------------------------------------------------------------------------------------------------
Key: HHH-2052
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2052
Project: Hibernate3
Type: Bug
Reporter: Tree 'Huggy Bear' Hugger
Attachments: bugtest.zip
Debug level logging attempted by MessageHelper falls over when constructing a loggable string for a mapped collection on the main entity.
Following the code in the stacktrace, I can see that MessageHelper expects the parent key for the collection relationship to be the primary key, but it is mapped to another field of a different type via a property-ref. Hence the ClassCastException below.
The work around is to set logging to INFO or higher.
I have also attached a pared-down zip with the maven 2 project containing the mappings and the unit test which fails.
The following JIRA issue may be the same thing:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-298
The following messages on the Hib forum demonstrate other interest in this issue:
http://forum.hibernate.org/viewtopic.php?t=949913
http://forum.hibernate.org/viewtopic.php?t=956778
http://forum.hibernate.org/viewtopic.php?t=962471
java.lang.ClassCastException: com.nomadsoft.cortex.domain.country.basic.BasicCountry
at org.hibernate.type.StringType.toString(StringType.java:44)
at org.hibernate.type.NullableType.toLoggableString(NullableType.java:168)
at org.hibernate.pretty.MessageHelper.collectionInfoString(MessageHelper.java:284)
at org.hibernate.loader.Loader.readCollectionElement(Loader.java:972)
at org.hibernate.loader.Loader.readCollectionElements(Loader.java:635)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:47)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:41)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:799)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:792)
at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:452)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:446)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:440)
at com.nomadsoft.cortex.infrastructure.hibernate.HibernateCountryRepository.getById(HibernateCountryRepository.java:26)
at com.nomadsoft.cortex.domain.country.basic.BasicCountryService.getCountry(BasicCountryService.java:34)
etc etc
--
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, 2 months
[Hibernate-JIRA] Issue Comment Edited: (HHH-1928) order-by mapping for collections overrides order by in Criteria
by Artem Karpenko (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1928?page=c... ]
Artem Karpenko edited comment on HHH-1928 at 1/24/12 9:53 AM:
--------------------------------------------------------------
This bug still exists in 3.6.9.Final.
Is this going to be fixed in any nearest future?
was (Author: artem.karpenko):
This bug still exists in 3.6.9.Final.
> order-by mapping for collections overrides order by in Criteria
> ---------------------------------------------------------------
>
> Key: HHH-1928
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1928
> Project: Hibernate ORM
> Issue Type: Bug
> Components: query-criteria
> Affects Versions: 3.2.0.cr3
> Reporter: Nguyen Hau Giang
> Attachments: testcase.zip
>
>
> relating to:
> HHH-594(order-by mapping for collections overrides order by in HQL)
> HHH-484(order-by not applied to collections fetched by OuterJoinLoader)
> Mapping(pseudo code):
> <class name="Master">
> <id name="id" />
> <set name="details" order-by="DISP_NO">
> <one-to-many class="Detail" />
> </set>
> </class>
> <class name="Detail">
> <id name="id" />
> <property name="dispNo" />
> <many-to-one name="master" class="Master" />
> </class>
> Same problem as in HHH-594, but instead of querying by HQL, when query by Criteria using join-fetch:
> session.createCriteria(Master.class)//
> .setFetchMode("details", FetchMode.JOIN)//
> .addOrder(Order.asc("id"))//
> .list();
> order-by mapping for collection overrides order by in Criteria:
> from
> Master this_
> left outer join
> Detail details2_
> on this_.id=details2_.ID
> order by
> details2_.DISP_NO,
> this_.id asc
> or when creating left-join alias:
> session.createCriteria(Master.class)//
> .createAlias("details", "D", Criteria.LEFT_JOIN)//
> .addOrder(Order.asc("id"))//
> .list();
> generated SQL:
> from
> Master this_
> left outer join
> Detail d1_
> on this_.id=d1_.ID
> order by
> d1_.DISP_NO,
> this_.id asc
> The order property specified in Criteria should be prior to order of collection mapping.
> I think this problem should be fixed as with HQL in HHH-594.
> For details, please see attached test case.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Commented: (HHH-1268) Unidirection OneToMany causes duplicate key entry violation when removing from list
by David Wery (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1268?page=c... ]
David Wery commented on HHH-1268:
---------------------------------
Same question, when this issue gonna be fixed :( !!!
> Unidirection OneToMany causes duplicate key entry violation when removing from list
> -----------------------------------------------------------------------------------
>
> Key: HHH-1268
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1268
> Project: Hibernate ORM
> Issue Type: Bug
> Affects Versions: 3.1, 3.5.6, 3.6.0
> Environment: 3.1 final
> MySql 4.1.14 using MYISAM tables
> Reporter: Rex Madden
> Assignee: Gail Badner
> Fix For: 3.2.x, 3.3.x
>
> Attachments: possible_solution.patch, src.zip
>
>
> Simple OneToMany parent/child relationship using the default table structure (2 tables and a join table)
> Add 3 children to the parent. Flush. Remove the first child. Flush throws error:
> Exception in thread "main" org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
> at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
> at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
> at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
> at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:980)
> at UnidirectionalOneToManyRemoveFromListBug.main(UnidirectionalOneToManyRemoveFromListBug.java:27)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
> Caused by: java.sql.BatchUpdateException: Duplicate key or integrity constraint violation, message from server: "Duplicate entry '5' for key 2"
> at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1461)
> at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
> ... 11 more
> The problem is that there is a unique key on the relationship table that gets violated. The session removes the last row in the relationship table, then attempts to rewrite the child_id's. It fails since there is a uniqueness constraint on that column.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months