[Hibernate-JIRA] Deleted: (HHH-2797) Insert using JDBC preparedSatement and MySQL
by Christian Bauer (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2797?page=c... ]
Christian Bauer deleted HHH-2797:
---------------------------------
> Insert using JDBC preparedSatement and MySQL
> --------------------------------------------
>
> Key: HHH-2797
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2797
> Project: Hibernate3
> Issue Type: Bug
> Environment: Hibernate release 3.2.1 with MYSQL 5.1 on linux platform
> Reporter: jelencik chantal
> Priority: Critical
>
> I have the following problem when i try to insert data in MySQL database using hibernate persist() :
> [DEBUG SQL]
> insert
> into
> FACTURE
> (DATE_FACTURE, DESCRIPTION, numero)
> values
> (?, ?, ?) [13:37:09.812] org.hibernate.jdbc.AbstractBatcher.log(AbstractBatcher.java:393)
> [DEBUG DateType] binding '20 août 2007' to parameter: 1 [13:37:09.828] org.hibernate.type.NullableType.nullSafeSet(NullableType.java:80)
> [DEBUG StringType] binding 'Facture B identifiée par 004' to parameter: 2 [13:37:09.843] org.hibernate.type.NullableType.nullSafeSet(NullableType.java:80)
> [DEBUG StringType] binding '004' to parameter: 3 [13:37:09.843] org.hibernate.type.NullableType.nullSafeSet(NullableType.java:80)
> Exception in thread "main" org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 7810893; expected: 1
> at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:71)
> at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
> at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
> at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
> at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
> at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
> at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
> at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
> at fr.mipih.commun.dao.HibernateFactureDao.store(HibernateFactureDao.java:194)
> at fr.mipih.commun.services.ServiceFacture.populateFactures(ServiceFacture.java:124)
> at fr.mipih.commun.Partie2.main(Partie2.java:22)
> See mapping file in attachement.
--
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
17 years, 4 months
[Hibernate-JIRA] Created: (HHH-2798) HQL update statement is translated into invalid SQL if there are multiple "member of"s
by Ludger Springmann (JIRA)
HQL update statement is translated into invalid SQL if there are multiple "member of"s
---------------------------------------------------------------------------------------
Key: HHH-2798
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2798
Project: Hibernate3
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.5
Environment: Problem detected in Hibernate 3.2.5 ga as well as in 3.2.0 ga
Database DB2 v8.1 on Solaris
Reporter: Ludger Springmann
Attachments: testcase_hql_update.zip
When using an update HQL with subselect containing at least two 'member of' expressions the SQL sent to DB2 is invalid. (An example as JUnit Test is attached to this entry.) The correspondig HQL with select instead of update works fine (see test). The problem is caused by a not qualifyed id in subselect query. Here is the result of the test (first select then update):
HQL: from de.iskv.hibernate.test.Person person where person.oid in (select p.oid from de.iskv.hibernate.test.Person p, de.iskv.hibernate.test.Address a, de.iskv.hibernate.test.Blog b where a.city='New York' and b.url='http://mydomain.com/blogs/al' and a member of p.addresses and b member of p.blogs)
Resulting SQL:
select
person0_.OID as OID0_,
person0_.NAME as NAME0_,
person0_.FIRSTNAME as FIRSTNAME0_
from
SPRINGMA.TEST_PERSON person0_
where
person0_.OID in (
select
person1_.OID
from
SPRINGMA.TEST_PERSON person1_,
SPRINGMA.TEST_PERSON address2_,
SPRINGMA.TEST_BLOG blog3_
where
address2_.CITY='New York'
and blog3_.URL='http://mydomain.com/blogs/al'
and (
address2_.OID in (
select
addresses4_.OID
from
SPRINGMA.TEST_PERSON addresses4_
where
person1_.OID=addresses4_.PERSON_ID
)
)
and (
blog3_.OID in (
select
blogs5_.OID
from
SPRINGMA.TEST_BLOG blogs5_
where
person1_.OID=blogs5_.PERSON_ID
)
)
)
HQL: update de.iskv.hibernate.test.Person person set name = ' ' where person.oid in (select p.oid from de.iskv.hibernate.test.Person p, de.iskv.hibernate.test.Address a, de.iskv.hibernate.test.Blog b where a.city='New York' and b.url='http://mydomain.com/blogs/al' and a member of p.addresses and b member of p.blogs)
Resulting SQL:
update
SPRINGMA.TEST_PERSON
set
NAME=' '
where
OID in (
select
person1_.OID
from
SPRINGMA.TEST_PERSON person1_,
SPRINGMA.TEST_PERSON address2_,
SPRINGMA.TEST_BLOG blog3_
where
address2_.CITY='New York'
and blog3_.URL='http://mydomain.com/blogs/al'
and (
OID in (
select
addresses4_.OID
from
SPRINGMA.TEST_PERSON addresses4_
where
person1_.OID=addresses4_.PERSON_ID
)
)
and (
OID in (
select
blogs5_.OID
from
SPRINGMA.TEST_BLOG blogs5_
where
person1_.OID=blogs5_.PERSON_ID
)
)
)
E
Time: 2,857
There was 1 error:
1) testUpdate(de.iskv.hibernate.test.HibernateSelectUpdateTestCase)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 de.iskv.hibernate.test.HibernateSelectUpdateTestCase.testUpdate(HibernateSelectUpdateTestCase.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at de.iskv.hibernate.test.HibernateSelectUpdateTestCase.main(HibernateSelectUpdateTestCase.java:104)
Caused by: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -203, SQLSTATE: 42702, SQLERRMC: OID
at com.ibm.db2.jcc.a.rf.e(rf.java:1680)
at com.ibm.db2.jcc.a.rf.a(rf.java:1239)
at com.ibm.db2.jcc.b.jb.h(jb.java:139)
at com.ibm.db2.jcc.b.jb.a(jb.java:43)
at com.ibm.db2.jcc.b.w.a(w.java:30)
at com.ibm.db2.jcc.b.cc.g(cc.java:160)
at com.ibm.db2.jcc.a.rf.n(rf.java:1219)
at com.ibm.db2.jcc.a.sf.gb(sf.java:1790)
at com.ibm.db2.jcc.a.sf.d(sf.java:2266)
at com.ibm.db2.jcc.a.sf.Y(sf.java:540)
at com.ibm.db2.jcc.a.sf.executeUpdate(sf.java:523)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)
... 22 more
FAILURES!!!
Tests run: 2, Failures: 0, Errors: 1
The DB2 error code means:
SQL0203N A reference to column name is ambiguous. (here OID)
Explanation: The column name is used in the statement and there is more than one possible column to which it could refer. This could be the result of:
- two tables specified in a FROM clause that have columns with the same name
- the ORDER BY clause refers to a name that applies to more than one column in the select list
- a reference to a column from the subject table in a CREATE TRIGGER statement does not use the correlation name to indicate if it refers to the old or new transition variable.
The column name needs further information to establish which of the possible table columns it is.
The statement cannot be processed.
User Response: Add a qualifier to the column name. The qualifier is the table name or correlation name. A column may need to be renamed in the select list.
sqlcode: -203
sqlstate: 42702
Both member of expressions result in a reference two column OID. This is ambiguous.
--
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
17 years, 4 months
[Hibernate-JIRA] Created: (HHH-2797) Insert using JDBC preparedSatement and MySQL
by jelencik chantal (JIRA)
Insert using JDBC preparedSatement and MySQL
--------------------------------------------
Key: HHH-2797
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2797
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.1
Environment: Hibernate release 3.2.1 with MYSQL 5.1 on linux platform
Reporter: jelencik chantal
Priority: Critical
Attachments: HibernateUtil.zip
I have the following problem when i try to insert data in MySQL database using hibernate persist() :
[DEBUG SQL]
insert
into
FACTURE
(DATE_FACTURE, DESCRIPTION, numero)
values
(?, ?, ?) [13:37:09.812] org.hibernate.jdbc.AbstractBatcher.log(AbstractBatcher.java:393)
[DEBUG DateType] binding '20 août 2007' to parameter: 1 [13:37:09.828] org.hibernate.type.NullableType.nullSafeSet(NullableType.java:80)
[DEBUG StringType] binding 'Facture B identifiée par 004' to parameter: 2 [13:37:09.843] org.hibernate.type.NullableType.nullSafeSet(NullableType.java:80)
[DEBUG StringType] binding '004' to parameter: 3 [13:37:09.843] org.hibernate.type.NullableType.nullSafeSet(NullableType.java:80)
Exception in thread "main" org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 7810893; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:71)
at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at fr.mipih.commun.dao.HibernateFactureDao.store(HibernateFactureDao.java:194)
at fr.mipih.commun.services.ServiceFacture.populateFactures(ServiceFacture.java:124)
at fr.mipih.commun.Partie2.main(Partie2.java:22)
See mapping file in attachement.
--
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
17 years, 4 months
[Hibernate-JIRA] Created: (HBX-973) ClassCastException: hbm2java generates HashSet instead of TreeSet when <set .... sort="MySorter"> is defined.
by Bill Mair (JIRA)
ClassCastException: hbm2java generates HashSet instead of TreeSet when <set .... sort="MySorter"> is defined.
-------------------------------------------------------------------------------------------------------------
Key: HBX-973
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-973
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2java
Affects Versions: 3.2beta8
Environment: Hibernate Tools 3.2.0.beta8
Derby
Reporter: Bill Mair
Mapping:
<class name="CharSkillGroup">
<composite-id>
<key-many-to-one name="charRecord" class="CharRecord" >
<column name="characterId" not-null="true" />
</key-many-to-one>
<key-many-to-one name="skillGroup" class="SkillGroup" >
<column name="skillGroupId" not-null="true" />
</key-many-to-one>
</composite-id>
<set name="skills" inverse="true" lazy="false" cascade="all" sort="eveapi.CharSkillSorter">
<key>
<column name="characterId"/>
<column name="skillGroupId"/>
</key>
<one-to-many class="CharSkill"/>
</set>
</class>
Generates:
private Set<CharSkill> skills = new HashSet<CharSkill>(0);
instead of
private Set<CharSkill> skills = new TreeSet<CharSkill>();
This causes a class cast exception when persisting.
--
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
17 years, 4 months
[Hibernate-JIRA] Created: (HBX-977) unable to recreate table using Hibernate 2
by sridhar negi (JIRA)
unable to recreate table using Hibernate 2
-------------------------------------------
Key: HBX-977
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-977
Project: Hibernate Tools
Issue Type: Sub-task
Reporter: sridhar negi
Priority: Critical
i m having problem recreating a deleted table from the database. I seems that the hibernate is refering some other database schema. The error which i m getting is as follow:
[java] alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 41632 DEBUG [main] hbm2ddl.SchemaUpdate - execute alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 41644 ERROR [main] hbm2ddl.SchemaUpdate - execute Unsuccessful: alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 41644 ERROR [main] hbm2ddl.SchemaUpdate - execute ORA-00942: table or view does not exist
[java] 41644 INFO [main] hbm2ddl.SchemaUpdate - execute schema update complete
How do i make hibernate to refer to a correct data base schema??
--
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
17 years, 4 months
[Hibernate-JIRA] Created: (HBX-976) unable to recreate table.
by sridhar negi (JIRA)
unable to recreate table.
-------------------------
Key: HBX-976
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-976
Project: Hibernate Tools
Issue Type: Bug
Components: ant
Affects Versions: 2.1
Environment: hibernate2.1 and oracle 9i.
Reporter: sridhar negi
i m not able to recreate table which i deleted fro the database. i shows message as if the tables were never deleted.
[java] alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 52085 DEBUG [main] hbm2ddl.SchemaUpdate - execute alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 52147 ERROR [main] hbm2ddl.SchemaUpdate - execute Unsuccessful: alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 52147 ERROR [main] hbm2ddl.SchemaUpdate - execute ORA-00942: table or view does not exist
May be the problem is of hibernate 2 , related one. it seems that hibernate is refering some other data base schema. how do i handle the situation?
--
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
17 years, 4 months