Hello,
I'm trying to reverse engineer an existing database schema. To start with, I'm using only one table(PYMT_STAT).
problem:
PymtStat.hbm.xml and PymtStat.java file still refers to big decimal instead of long (even though hibernate.reveng.xml refers to long as given below)
In the part of log file content given below there is an message as follows:
Sql type mismatch for Column org.hibernate.mapping.Column(PYMT_STAT_KEY) between DB and wanted hibernate type. Sql type set to 2 instead of 3
In would appreciate any help in this issue.
Also, during the reverse engineering process PymtStat.hbm.xml contains
<generator class="assigned" />. I would like to know is there any settings I can perform the use generator class="sequence" etc. because In our oracle settings we are using nextval to get primary key values.
with ddl shown below:
CREATE TABLE PYMT_STAT
(
PYMT_STAT_KEY NUMBER NOT NULL,
PYMT_STAT_NM VARCHAR2(40 BYTE),
CRTE_DT DATE,
CRTE_BY_USER_ID VARCHAR2(30 BYTE),
LAST_UPDT_DT DATE,
LAST_UPDT_USER_ID VARCHAR2(30 BYTE)
)
TABLESPACE ...
NOPARALLEL;
CREATE UNIQUE INDEX PYMT_STAT_PKIDX ON PYMT_STAT
(PYMT_STAT_KEY)
java version and tools used:
jdk 1.4.2, hibernate 3.1 beta 3 and hibernate tools-3.1.0.alpha5, ojdbc14.jar(from oracle)
<?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>
<type-mapping>
<sql-type jdbc-type="NUMERIC" hibernate-type="long" />
</type-mapping>
<table-filter match-schema="TEST" match-name="PYMT_STAT" exclude="false" />
<table-filter match-schema=".*" match-name=".*" exclude="true" />
</hibernate-reverse-engineering>
Hibernate version:
hibernate 3.1 beta 3 and hibernate tools-3.1.0.alpha5
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.xyz.PymtStat" table="PYMT_STAT" schema="TEST">
<id name="pymtStatKey" type="big_decimal">
<column name="PYMT_STAT_KEY" precision="22" scale="0" />
<generator class="assigned" />
</id>
<property name="pymtStatNm" type="string">
<column name="PYMT_STAT_NM" length="40" />
</property>
<property name="crteDt" type="date">
<column name="CRTE_DT" length="7" />
</property>
<property name="crteByUserId" type="string">
<column name="CRTE_BY_USER_ID" length="30" />
</property>
<property name="lastUpdtDt" type="date">
<column name="LAST_UPDT_DT" length="7" />
</property>
<property name="lastUpdtUserId" type="string">
<column name="LAST_UPDT_USER_ID" length="30" />
</property>
</class>
</hibernate-mapping>
generated java code:
public class PymtStat implements java.io.Serializable {
// Fields
private java.math.BigDecimal pymtStatKey;
private String pymtStatNm;
private Date crteDt;
private String crteByUserId;
private Date lastUpdtDt;
private String lastUpdtUserId;
// Constructors
/** default constructor */
public PymtStat() {
}
/** constructor with id */
public PymtStat(java.math.BigDecimal pymtStatKey) {
this.pymtStatKey = pymtStatKey;
}
// Property accessors
/**
*
*/
public java.math.BigDecimal getPymtStatKey() {
return this.pymtStatKey;
}
public void setPymtStatKey(java.math.BigDecimal pymtStatKey) {
this.pymtStatKey = pymtStatKey;
}
...
...
.
.
.
...
}
Name and version of the database you are using:
oracle 9
Debug level Hibernate log excerpt:
13:24:48,519 DEBUG JDBCBinder:310 - primary key for org.hibernate.mapping.Table(TEST.PYMT_STAT) -> org.hibernate.mapping.PrimaryKey(PYMT_STAT[org.hibernate.mapping.Column(PYMT_STAT_KEY)]) as PYMT_STAT_PK
13:24:48,569 DEBUG Project:159 - Finding class oracle.net.ns.Message11
13:24:48,573 DEBUG Project:159 - Loaded from /apps/projects/wsClaims/lib/ojdbc14.jar oracle/net/ns/Message11.class
13:24:48,578 DEBUG Project:159 - Finding class oracle.net.ns.Message
13:24:48,582 DEBUG Project:159 - Loaded from /apps/projects/wsClaims/lib/ojdbc14.jar oracle/net/ns/Message.class
13:24:48,586 DEBUG Project:159 - Class oracle.net.ns.Message loaded from ant loader (parentFirst)
13:24:48,593 DEBUG Project:159 - Class oracle.net.ns.Message11 loaded from ant loader (parentFirst)
13:24:48,599 DEBUG Project:159 - Class java.util.MissingResourceException loaded from parent loader (parentFirst)
13:24:48,604 WARN JDBCBinder:609 - Exception while trying to get indexinfo on TEST.PYMT_STAT=ORA-01031: insufficient privileges
13:24:48,609 DEBUG JDBCBinder:87 - Calling getExportedKeys on org.hibernate.mapping.Table(TEST.PYMT_STAT)
13:24:48,639 DEBUG JDBCBinder:101 - foreign key name: AMT_PYMT_STAT_FK
13:24:48,642 DEBUG JDBCBinder:106 - Foreign key AMT_PYMT_STAT_FK references unknown or filtered table AMT
13:24:48,950 DEBUG JDBCBinder:458 - Sql type mismatch for Column org.hibernate.mapping.Column(PYMT_STAT_KEY) between DB and wanted hibernate type. Sql type set to 2 instead of 3
|