[Hibernate-JIRA] Created: (HHH-3229) Make cascade rules more transparent/explicit/deterministic
by Chris Bredesen (JIRA)
Make cascade rules more transparent/explicit/deterministic
----------------------------------------------------------
Key: HHH-3229
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3229
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.6, 3.2.5, 3.2.4.sp1
Reporter: Chris Bredesen
Cascade rules are prone to different behavior based on the order in which properties appear in mapping XML. It is possible that an unexpected TransientObjectException may arise from certain operations when an object graph with circular references is merged (and possibly persisted/updated, etc).
For example, if a transient instance is reachable through more than once path from a root entity, it is not clear whether operations will be cascaded to it. The order in which the properties are mapped plays a part in determining cascade paths, but the rules are not documented.
Possible resolutions include:
1. Documenting the rules so that a programmer can make educated decisions about mapping.
2. Enhancing the algorithm such that order no longer matters and the rules are deterministic.
3. ???
--
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
15 years, 8 months
[Hibernate-JIRA] Created: (HBX-779) jdbc reengineer sql-type problem with oracle 9i
by jacky hua (JIRA)
jdbc reengineer sql-type problem with oracle 9i
-----------------------------------------------
Key: HBX-779
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-779
Project: Hibernate Tools
Type: Bug
Components: reverse-engineer
Versions: 3.2beta8
Environment: windowsxp sp2, jdk 1.4.2, eclipse 3.1.2
Reporter: jacky hua
I used the ant task hibernate-tools provided like the below to generate hbms xml
<target name="default" description="generate hbm">
<delete dir="./generate"/>
<mkdir dir="./generate"/>
<hibernatetool destdir="./generate">
<jdbcconfiguration
configurationfile="./metadata/hibernate.cfg.xml"
revengfile="./metadata/hibernate.reveng.xml"
packagename="net.ema.examples.sa"
detectmanytomany="true"
detectoptimisticlock="true">
</jdbcconfiguration>
<hbm2hbmxml destdir="./generate" />
</hibernatetool>
</target>
the ./metadata/hibernate.cfg.xml like the below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering
SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<schema-selection match-catalog="TITAN" match-schema="TITAN" />
<type-mapping>
<!-- jdbc-type is name fom java.sql.Types -->
<!-- length, scale and precision can be used to specify the mapping precisly -->
<sql-type jdbc-type="NUMERIC" precision="1"
hibernate-type="boolean" />
<!-- the type-mappings are ordered. This mapping will be consulted last,
thus overriden by the previous one if precision=1 for the column -->
<sql-type jdbc-type="NUMERIC" precision="19" hibernate-type="long" />
<sql-type jdbc-type="TIMESTAMP" hibernate-type="java.util.Date" />
</type-mapping>
<!-- BIN$ is recycle bin tables in Oracle -->
<table-filter match-name="BIN$.*" exclude="true" />
</hibernate-reverse-engineering>
But the <sql-type jdbc-type="NUMERIC" precision="19" hibernate-type="long" /> didn't work, also generate big_decimal type not long type, otherwise the others two sql-type rules worked. the not affected column:USER_ID was pk of my table. the generated hbm file is like the below:
<class name="net.ema.examples.sa.UserModel" table="T_SA_USER" schema="TITAN">
<id name="userId" type="big_decimal">
<column name="USER_ID" scale="0" />
<generator class="assigned" />
</id>
<property name="logonName" type="string">
<column name="LOGON_NAME" length="60" />
</property>
<property name="password" type="string">
<column name="PASSWORD" length="80" />
</property>
<property name="isOrgAdmin" type="java.lang.Boolean">
<column name="IS_ORG_ADMIN" precision="1" scale="0" />
</property>
<property name="remark" type="string">
<column name="REMARK" length="400" />
</property>
<property name="createDate" type="java.util.Date">
<column name="CREATE_DATE" length="11" />
</property>
<property name="status" type="string">
<column name="STATUS" length="2" />
</property>
</class>
--
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
15 years, 8 months
[Hibernate-JIRA] Created: (HHH-3620) Oracle - testWithClause fails due to "Missing IN or OUT parameter at index:: 1"
by Juraci Paixao Krohling (JIRA)
Oracle - testWithClause fails due to "Missing IN or OUT parameter at index:: 1"
-------------------------------------------------------------------------------
Key: HHH-3620
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3620
Project: Hibernate Core
Issue Type: Bug
Components: testsuite
Affects Versions: 3.3.x
Environment: Oracle 9i, Branch_3_3
Reporter: Juraci Paixao Krohling
Test testWithClause (org.hibernate.test.hql.WithClauseTest) fails due to "Missing IN or OUT parameter at index:: 1"
Stack trace:
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2231)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:364)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.test.hql.WithClauseTest.testWithClause(WithClauseTest.java:112)
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 junit.framework.TestCase.runTest(TestCase.java:168)
at org.hibernate.junit.functional.FunctionalTestCase.runTest(FunctionalTestCase.java:125)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.hibernate.junit.UnitTestCase.runBare(UnitTestCase.java:63)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at org.hibernate.junit.functional.FunctionalTestClassTestSuite.runTest(FunctionalTestClassTestSuite.java:115)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.hibernate.junit.functional.FunctionalTestClassTestSuite.run(FunctionalTestClassTestSuite.java:84)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 1
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1711)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3311)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3361)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
... 31 more
--
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
15 years, 8 months
[Hibernate-JIRA] Created: (EJB-381) EntityManager doesn't care about INSERT trigger of Oracle XE
by Juergen Zimmermann (JIRA)
EntityManager doesn't care about INSERT trigger of Oracle XE
------------------------------------------------------------
Key: EJB-381
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-381
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.4.0.GA
Environment: Hibernate EM 3.4.0, Hibernate Annotations 3.4.0, Hibernate Commons Annotations 3.1.0, Hibernate 3.3.0.SP1, Hibernate Validator 3.1.0.CR2, JDK 1.6.0_07
Reporter: Juergen Zimmermann
I have an abstract entity class with 2 derived concrete classes:
@Entity
@Table(name="kunde")
@Inheritance
@DiscriminatorColumn(name="art", length=1)
@XmlRootElement
@XmlSeeAlso({
Firmenkunde.class,
Privatkunde.class
})
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class Kunde implements java.io.Serializable {
@Id
@GeneratedValue(generator="kunde_sequence_name")
@SequenceGenerator(name="kunde_sequence_name", sequenceName="kunde_k_id_seq", allocationSize=1)
@Column(name="k_id", nullable=false)
@XmlAttribute(name="id", required=true)
protected Long id = KEINE_ID;
@Version
@XmlTransient
protected int version = ERSTE_VERSION;
@Column(length=32, nullable=false)
@XmlElement(required=true)
protected String nachname = "";
...
@Column(length=32, unique=true)
protected String username = "";
...
}
The table is created as follows:
CREATE TABLE kunde(
k_id NUMBER(16) NOT NULL PRIMARY KEY,
version NUMBER(8) DEFAULT 0,
nachname VARCHAR2(32) NOT NULL,
...
art VARCHAR2(2) DEFAULT 'P',
...
username VARCHAR2(32) NOT NULL UNIQUE,
...
);
Additionally there is this sequence and insert trigger for column username.
CREATE SEQUENCE kunde_k_id_seq START WITH 200 NOMAXVALUE
/
CREATE OR REPLACE TRIGGER kunde_trigger_insert
BEFORE INSERT ON kunde
FOR EACH ROW
BEGIN
:NEW.username := TO_CHAR(:NEW.k_id);
END;
/
New objects are inserted into the database using this code which works fine with PostgreSQL. However, using Oracle XE the insert trigger isn't considered:
public List<Kunde> insertKunden(List<Kunde> kunden) {
if (kunden == null || kunden.isEmpty()) {
return new ArrayList<Kunde>(0);
}
for (Kunde k: kunden) {
em.persist(k);
}
return kunden;
}
The attribute "username" is null using Oracle XE, but using PostgreSQL it has the value produced by the INSERT trigger.
--
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
15 years, 8 months