[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
[Hibernate-JIRA] Created: (HHH-3705) NPE encountered on using AnnotationConfiguration
by Kaizer (JIRA)
NPE encountered on using AnnotationConfiguration
------------------------------------------------
Key: HHH-3705
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3705
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.3.1
Reporter: Kaizer
Attachments: Hibernate_AnnotationTest.zip
I have a bidirectional association between a Client and a ClientAddress. When I load a Client, the reference of Client set in the ClientAddress is Client_$$_javassist_0 which I think is the proxy. Now when I update or delete the client, I get a NPE -
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.envers.event.AuditEventListener.generateBidirectionalCollectionChangeWorkUnits(AuditEventListener.java:107)
at org.hibernate.envers.event.AuditEventListener.onPostDelete(AuditEventListener.java:153)
at org.hibernate.action.EntityDeleteAction.postDelete(EntityDeleteAction.java:150)
at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:117)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
This is because the entry in the EntitiesConfigurations Map is of Client and not Client_$$_javassist_0.
This works perfectly fine on moving to JPA (EntityManager, etc).
I have attached a test case for the same. The DB settings will need to be changed. The above exception is encountered on running the deleteClient method in HibernateAnnotationTest.java.
--
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-418) JBPAPP-1787 - Implement tearDown in EJB3TestCase
by Juraci Paixao Krohling (JIRA)
JBPAPP-1787 - Implement tearDown in EJB3TestCase
------------------------------------------------
Key: EJB-418
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-418
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Environment: Any database using the tests PersistTest and XmlAttributeOverrideTest.
Reporter: Juraci Paixao Krohling
Attachments: EJB3TestCase.java.diff
https://jira.jboss.org/jira/browse/JBPAPP-1787
There are some tests in EM test suite which subclasses EJB3TestCase (all of them in the package org.hibernate.ejb.test.ops), while most of the other tests subclasses org.hibernate.ejb.test.TestCase.
Tests subclassing EJB3TestCase are not having its tables dropped after the execution, causing failures in other tests which uses the same table names with different table definitions.
How to reproduce:
- Drop all tables from the database to be used in the test
- Run org.hibernate.ejb.test.ops.PersistTest#testBasic
- There should be, among others, three tables: employer_employee,employer,employee
- Run org.hibernate.ejb.test.xml.XmlAttributeOverrideTest#testAttributeOverriding
- It should fail to drop the table "employee" (check the logs), failing with "java.sql.BatchUpdateException: Unknown column 'home_city' in 'field list'"
- Drop all tables from the database
- Run org.hibernate.ejb.test.xml.XmlAttributeOverrideTest#testAttributeOverriding again
- There should be no failures.
--
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