Sorry for posing the same question again...but this time i am giving more detailed desciption of my problem...but I am completely stuck up here...plz help
Hibernate version:2.1.7
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping schema="myschema"
package="com.test.webservice.impl">
<class name="User" table="USER_DETAIL">
<id name="id" type="int" column="USER_ID">
<generator class="sequence" />
</id>
<property name="loginId" type="string" length="15"
column="LOGIN_ID">
</property>
<property name="password" type="string" length="20"
column="PASSWORD" />
<property name="emailId" type="string" length="50"
column="EMAIL_ID" />
<property name="active" type="boolean" column="IS_ACTIVE" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="false" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
<set name="rolesSet" table="USER_ROLE_MAP" access="field">
<key column="USER_ID" />
<many-to-many column="ROLE_ID" class="Role" />
</set>
<set name="groupsSet" table="USER_GROUP_MAP" access="field">
<key column="USER_ID" />
<many-to-many column="GROUP_ID" class="Group" />
</set>
<many-to-one name="defaultPrintDevice" class="PrintDevice" column="DEF_PRINT_DEV_ID"></many-to-one>
<many-to-one name="defaultPreviewDevice" class="PrintDevice" column="DEF_PREVIEW_DEV_ID"></many-to-one>
</class>
<class name="Group" table="GROUP_DETAIL">
<id name="id" type="int" column="GROUP_ID">
<generator class="sequence" />
</id>
<property name="name" type="string" length="50"
column="GROUP_NAME" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
<set name="subgroupsSet" table="SUB_GROUP" access="field">
<key column="GROUP_ID" />
<one-to-many class="com.test.webservice.databean.SubGroup" />
</set>
<set name="parentsSet" table="SUB_GROUP" access="field">
<key column="PARENT_GROUP" />
<one-to-many class="com.test.webservice.databean.SubGroup" />
</set>
<set name="membersSet" table="USER_GROUP_MAP" access="field">
<key column="GROUP_ID" />
<many-to-many column="USER_ID" class="User" />
</set>
<set name="rolesSet" table="GROUP_ROLE_MAP" access="field">
<key column="GROUP_ID" />
<many-to-many column="ROLE_ID" class="Role" />
</set>
</class>
<class name="com.test.webservice.databean.SubGroup" table="SUB_GROUP">
<composite-id>
<key-property name="groupId" column="GROUP_ID" />
<key-property name="parentGroup" column="PARENT_GROUP" />
</composite-id>
</class>
<class name="Role" table="ROLE">
<id name="id" type="int" column="ROLE_ID">
<generator class="sequence" />
</id>
<property name="name" type="string" length="50" column="ROLE_NAME" />
<property name="adminRole" type="boolean" column="ADMIN_ROLE" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
<set name="privilegesSet" table="ROLE_PRIV_MAP"
access="field">
<key column="ROLE_ID" />
<many-to-many column="PRIVILEGE_ID" class="Privilege" />
</set>
</class>
<class name="Privilege" table="PRIVILEGE">
<id name="id" type="int" column="PRIVILEGE_ID">
<generator class="sequence" />
</id>
<property name="name" type="string" length="50"
column="PRIVILEGE_NAME" />
</class>
<class name="Notification" table="NOTIFICATION">
<id name="id" type="int" column="NOTIFICATION_ID">
<generator class="sequence" />
</id>
<property name="name" type="string" length="50" column="NOTIFICATION_NAME" />
<property name="notificationType" length="10" type="string"
column="NOTIFICATION_TYPE" access="field" />
<property name="notificationText" length="2000" type="string"
column="NOTIFICATION_TEXT" access="field" />
<property name="enable" type="boolean" column="ENABLE_STATUS"
access="field" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
<set name="users" table="NOTIFICATION_USERS" access="field">
<key column="NOTIFICATION_ID" />
<many-to-many column="USER_ID" class="User" />
</set>
<set name="groups" table="NOTIFICATION_GROUP" access="field">
<key column="NOTIFICATION_ID" />
<many-to-many column="GROUP_ID" class="Group" />
</set>
</class>
<class name="State" table="STATE">
<id name="id" type="int" column="STATE_ID">
<generator class="sequence" />
</id>
<property name="name" type="string" length="50" column="STATE_NAME" />
<property name="type" type="string" length="10" column="STATE_TYPE" />
<property name="stateDesc" type="string" length="50" column="STATE_DESC"
access="field" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
<set name="notificationsSet" table="STATE_NOTIFICATION"
access="field">
<key column="STATE_ID" />
<many-to-many column="NOTIFICATION_ID" class="Notification" />
</set>
</class>
<class name="com.test.webservice.databean.StateMap" table="STATE_MAP">
<composite-id>
<key-many-to-one name="stateId" class="State" column="STATE_ID" />
<key-property name="associationId" type="int"
column="ASSOCIATION_ID" />
<key-many-to-one name="entityType" class="com.test.webservice.databean.EntityType"
column="ENTITY_TYPE" />
</composite-id>
<property name="nextState" type="int"
column="NEXT_STATE_ID" />
<property name="startState" type="boolean" column="START_STATE" />
<property name="actionRequired" type="string" length="50"
column="ACTION_REQD" />
<property name="responsibleParty" type="string" length="20"
column="RESPONSIBLE_PARTY" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
</class>
<class name="DataSource" table="DATASOURCE">
<id name="id" type="int" column="DATASOURCE_ID">
<generator class="sequence" />
</id>
<property name="name" type="string" length="50"
column="DATASOURCE_NAME" />
<property name="createdDate" type="calendar"
column="CREATED_DATE" />
<property name="dataSourceType" type="string" length="10"
column="DATASOURCE_TYPE" />
<property name="outputFormat" type="string" length="30"
column="OUTPUT_FORMAT" />
<property name="retentionPeriod" type="long"
column="RETENTION_PERIOD" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
<set name="rolesSet" table="DATASOURCE_ROLE_MAP"
access="field">
<key column="DATASOURCE_ID" />
<many-to-many column="ROLE_ID" class="Role" />
</set>
<set name="printJobsSet" table="PRINTJOB_DATASOURC" access="field">
<key column="DATASOURCE_ID" />
<many-to-many column="PRINTJOB_ID" class="PrintJob" />
</set>
</class>
<class name="PrintDevice" table="PRINT_DEVICE">
<id name="id" type="int" column="PRINT_DEVICE_ID">
<generator class="sequence" />
</id>
<property name="name" type="string" length="50"
column="PRINT_DEVICE_NAME" />
<property name="previewable" type="boolean"
column="PREVIEWABLE" />
<property name="printDeviceType" type="string" length="20"
column="PRINT_DEVICE_TYPE" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
</class>
<class name="com.test.webservice.databean.PrintJobDeviceMap" table="PRINTJOB_PRINTDEV">
<composite-id>
<key-many-to-one name="printJobId" class="PrintJob"
column="PRINTJOB_ID" />
<key-many-to-one name="printDeviceId" class="PrintDevice"
column="PRINT_DEVICE_ID" />
<key-property name="locationType" type="string" length="10"
column="LOCATION_TYPE" />
</composite-id>
</class>
<class name="PrintJob" table="PRINTJOB">
<id name="id" type="int" column="PRINTJOB_ID">
<generator class="sequence" />
</id>
<property name="name" type="string" length="50"
column="PRINTJOB_NAME" />
<property name="createdDate" type="calendar"
column="CREATED_DATE" />
<property name="state" type="int" column="CURRENT_STATE_ID" />
<property name="parentPrintJobId" type="int"
column="PARENT_PRINTJOB_ID" />
<property name="retentionPeriod" type="long"
column="RETENTION_PERIOD" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
<many-to-one name="publication" class="Publication"
column="PARENT_PUB_ID" />
<set name="printDevicesSet" table="PRINTJOB_PRINTDEV"
access="field">
<key column="PRINTJOB_ID" />
<one-to-many class="com.test.webservice.databean.PrintJobDeviceMap" />
</set>
<set name="dataSourcesSet" table="PRINTJOB_DATASOURC"
access="field">
<key column="PRINTJOB_ID" />
<many-to-many column="DATASOURCE_ID" class="DataSource" />
</set>
</class>
<class name="Publication" table="PUBLICATION">
<id name="id" type="int" column="PUB_ID">
<generator class="sequence" />
</id>
<property name="name" type="string" length="50"
column="PUB_NAME" />
<property name="startDate" type="calendar" column="START_DATE" />
<property name="printable" type="boolean" column="PRINT_STATUS" />
<property name="fileName" type="string" length="255"
column="FILE_NAME" />
<property name="endDate" type="calendar" column="END_DATE" />
</class>
<class name="Category" table="CATEGORY">
<id name="id" type="int" column="CATEGORY_ID">
<generator class="sequence" />
</id>
<property name="name" type="string" length="50"
column="CATEGORY_NAME" />
<property name="type" type="string" length="10"
column="CATEGORY_TYPE" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
<set name="children" table="SUB_CATEGORY" access="field">
<key column="CATEGORY_ID" />
<one-to-many class="com.test.webservice.databean.SubCategory" />
</set>
<set name="parents" table="SUB_CATEGORY" access="field">
<key column="PARENT_CAT" />
<one-to-many class="com.test.webservice.databean.SubCategory" />
</set>
</class>
<class name="com.test.webservice.databean.SubCategory" table="SUB_CATEGORY">
<composite-id>
<key-property name="category" type="int"
column="CATEGORY_ID" />
<key-property name="parentCategory" type="int"
column="PARENT_CAT" />
</composite-id>
</class>
<class name="Annotation" table="ANNOTATION">
<id name="id" type="int" column="ANNOTATION_ID">
<generator class="sequence" />
</id>
<property name="comment" type="string" column="ANNOTATION_TEXT"
length="255" />
<property name="user" type="int" column="LAST_UPD_USER_ID"
not-null="true" />
<property name="when" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
</class>
<class name="com.test.webservice.databean.AnnotationMap" table="ANNOTATION_MAP">
<composite-id>
<key-many-to-one name="annotationId" class="Annotation"
column="ANNOTATION_ID" />
<key-property name="associationId" type="int"
column="ASSOCIATION_ID" />
<key-many-to-one name="entityType" class="com.test.webservice.databean.EntityType"
column="ENTITY_TYPE" />
</composite-id>
</class>
<class name="com.test.webservice.databean.CategoryMap" table="CATEGORY_MAP">
<composite-id>
<key-many-to-one name="categoryId" class="Category"
column="CATEGORY_ID" />
<key-property name="associationId" type="int"
column="ASSOCIATION_ID" />
<key-many-to-one name="entityType" class="com.test.webservice.databean.EntityType"
column="ENTITY_TYPE" />
</composite-id>
</class>
<class name="com.test.webservice.databean.EntityType" table="ENTITY_TYPE">
<id name="entityType" type="string" length="10"
column="ENTITY_TYPE">
<generator class="assigned" />
</id>
<property name="description" type="string" length="100"
column="ENTITY_TYPE_DESC" />
</class>
<class name="AuditTrail" table="AUDIT_TRAIL">
<composite-id>
<key-property name="associationId" type="int"
column="ASSOCIATION_ID" access="field"/>
<key-many-to-one name="entityType" class="com.test.webservice.databean.EntityType"
column="ENTITY_TYPE" access="field"/>
</composite-id>
<property name="name" type="string" length="50" column="NAME" />
<property name="eventType" type="string" length="20"
column="EVENT_TYPE" />
<property name="eventDescription" type="string" length="20"
column="DESCRIPTIVE_TEXT" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
</class>
<class name="com.test.webservice.databean.SystemProperties" table="SYSTEM_PROPERTIES">
<id name="key" type="string" length="20"
column="SYS_PROPERTY_KEY">
<generator class="assigned" />
</id>
<property name="value" type="string" length="50"
column="SYS_PROPERTY_VALUE" />
<property name="lastUpdateUserId" type="int"
column="LAST_UPD_USER_ID" not-null="true" />
<property name="lastUpdateTimestamp" type="calendar"
column="LAST_UPD_TIMESTAMP" not-null="true" />
</class>
<class name="com.test.webservice.impl.Property" table="PROPERTIES">
<composite-id>
<key-property name="associationId" type="int"
column="ASSOCIATION_ID" access="field"/>
<key-property name="key" type="string" length="20"
column="PROPERTY_KEY" />
<key-many-to-one name="entityType" class="com.test.webservice.databean.EntityType"
column="ENTITY_TYPE" access="field"/>
</composite-id>
<property name="value" type="string" length="50"
column="PROPERTY_VALUE" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using: Oracle 9.0.1.1.1
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
- Loading XML bean definitions from file [C:\Service\WEB-INF\classes\..\..\..\Service\WEB-INF\applicationCon
text.xml]
- Bean factory for application context [org.springframework.context.support.File
SystemXmlApplicationContext;hashCode=11650554]: org.springframework.beans.factor
y.support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,t
ransactionManager,dao,facade,userManagerTarget]; root of BeanFactory hierarchy
- 6 beans defined in application context [org.springframework.context.support.Fi
leSystemXmlApplicationContext;hashCode=11650554]
- Unable to locate MessageSource with name 'messageSource': using default [org.s
pringframework.context.support.StaticMessageSource: {}]
- Unable to locate ApplicationEventMulticaster with name 'applicationEventMultic
aster': using default [org.springframework.context.event.SimpleApplicationEventM
ulticaster@1617189]
- Refreshing listeners
- Pre-instantiating singletons in factory [org.springframework.beans.factory.sup
port.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,transa
ctionManager,dao,facade,userManagerTarget]; root of BeanFactory hierarchy]
- Creating shared instance of singleton bean 'dataSource'
- Loaded JDBC driver: oracle.jdbc.driver.OracleDriver
- Creating shared instance of singleton bean 'sessionFactory'
- Hibernate 2.1.7
- hibernate.properties not found
- using CGLIB reflection optimizer
- using JDK 1.4 java.sql.Timestamp handling
- Mapping class: com.test.webservice.impl.DataSource -> DATASOURCE
- Building new Hibernate SessionFactory
- processing one-to-many association mappings
- processing one-to-one association property references
- processing foreign key constraints
- Using dialect: net.sf.hibernate.dialect.Oracle9Dialect
- Use outer join fetching: true
- Initializing connection provider: org.springframework.orm.hibernate.LocalDataS
ourceConnectionProvider
- No TransactionManagerLookup configured (in JTA environment, use of process lev
el read-write cache is not recommended)
- Use scrollable result sets: true
- Use JDBC3 getGeneratedKeys(): true
- Optimize cache for minimal puts: false
- echoing all SQL to stdout
- Query language substitutions: {}
- cache provider: net.sf.hibernate.cache.EhCacheProvider
- instantiating and configuring caches
- building session factory
Tthis is the pulic def ctor
- Not binding factory to JNDI, no JNDI name configured
- Using dialect: net.sf.hibernate.dialect.Oracle9Dialect
- processing one-to-many association mappings
- processing one-to-one association property references
- processing foreign key constraints
- processing one-to-many association mappings
- processing one-to-one association property references
- processing foreign key constraints
- Running hbm2ddl schema export
- exporting generated schema to database
- Initializing connection provider: org.springframework.orm.hibernate.LocalDataS
ourceConnectionProvider
- schema export complete
- Creating shared instance of singleton bean 'transactionManager'
- Loading XML bean definitions from class path resource [org/springframework/jdb
c/support/sql-error-codes.xml]
- Creating shared instance of singleton bean 'DB2'
- Creating shared instance of singleton bean 'HSQL'
- Creating shared instance of singleton bean 'MS-SQL'
- Creating shared instance of singleton bean 'MySQL'
- Creating shared instance of singleton bean 'Oracle'
- Creating shared instance of singleton bean 'Informix'
- Creating shared instance of singleton bean 'PostgreSQL'
- Creating shared instance of singleton bean 'Sybase'
- SQLErrorCodes loaded: [HSQL Database Engine, Oracle, Sybase SQL Server, Inform
ix Dynamic Server, Microsoft SQL Server, PostgreSQL, MySQL, DB2*]
- Using DataSource [org.springframework.jdbc.datasource.DriverManagerDataSource@
1114460] of Hibernate SessionFactory for HibernateTransactionManager
- Creating shared instance of singleton bean 'dao'
- Creating shared instance of singleton bean 'facade'
- Creating shared instance of singleton bean 'userManagerTarget'
- Using JDK 1.4 collections
Hibernate: select group1_ic.hibernate_sequence.nextval from dual
Hibernate: insert into group1_ic.DATASOURCE (DATASOURCE_NAME, CREATED_DATE, DATA
SOURCE_TYPE, OUTPUT_FORMAT, RETENTION_PERIOD, LAST_UPD_USER_ID, LAST_UPD_TIMESTAMP, DATASOURCE_ID) values (?, ?, ?, ?, ?, ?, ?, ?)
the generated id is 1
Following are the s/w i am using:
JBoss 3.2.1.
Spring 1.1.3
Axis 1.1.
Oracle JDBC driver: 9.2.0.3.0
I am developing a webservice using Axis 1.1.
I defined the interface first for the webservice. The classes used in the interface are the same persistent classes that are used by Hibernate.
Eg:
public void DataSource createDataSource(String type, String name....);
Axis modifies my DataSource class. It overrides equals and hashcode methods and it also adds serializer and deserializer for DataSource class. The modifed DataSource class will be used by Hibernate to save a record in the DataSource table. I created the database with those axis generated persistent classes. I was able to successfully create the database.
Following is the DDL for Datasource table:
create table "myschema"."DATASOURCE" ("DATASOURCE_ID" NUMBER(10) not null, "DATASOURCE_NAME" VARCHAR2(50), "CREATED_DATE" DATE, "DATASOURCE_TYPE" VARCHAR2(10), "OUTPUT_FORMAT" VARCHAR2(30), "RETENTION_PERIOD" NUMBER(19), "LAST_UPD_USER_ID" NUMBER(10) not null, "LAST_UPD_TIMESTAMP" DATE not null, constraint "myschema"."SYS_C0013679" primary key ("DATASOURCE_ID"));
Following is my DataSource class
Code:
/**
* DataSource.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
package com.test.webservice.impl;
import java.util.Set;
public class DataSource extends com.test.webservice.impl.NamedObject implements java.io.Serializable {
private byte[] dataBytes;
private long dataLength;
private java.lang.String dataURI;
private java.util.Calendar createdDate;
private java.lang.String dataSourceType;
private java.lang.String outputFormat;
private long retentionPeriod;
private Set rolesSet;
private Set printJobsSet;
/**
* @return Returns the retentionPeriod.
*/
public long getRetentionPeriod() {
return retentionPeriod;
}
/**
* @param retentionPeriod The retentionPeriod to set.
*/
public void setRetentionPeriod(long retentionPeriod) {
this.retentionPeriod = retentionPeriod;
}
public DataSource() {
}
public byte[] getDataBytes() {
return dataBytes;
}
public void setDataBytes(byte[] dataBytes) {
this.dataBytes = dataBytes;
}
public long getDataLength() {
return dataLength;
}
public void setDataLength(long dataLength) {
this.dataLength = dataLength;
}
public java.lang.String getDataURI() {
return dataURI;
}
public void setDataURI(java.lang.String dataURI) {
this.dataURI = dataURI;
}
public java.util.Calendar getCreatedDate() {
return createdDate;
}
public void setCreatedDate(java.util.Calendar createdDate) {
this.createdDate = createdDate;
}
public java.lang.String getDataSourceType() {
return dataSourceType;
}
public void setDataSourceType(java.lang.String dataSourceType) {
this.dataSourceType = dataSourceType;
}
public java.lang.String getOutputFormat() {
return outputFormat;
}
public void setOutputFormat(java.lang.String outputFormat) {
this.outputFormat = outputFormat;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof DataSource)) return false;
DataSource other = (DataSource) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
((this.dataBytes==null && other.getDataBytes()==null) ||
(this.dataBytes!=null &&
java.util.Arrays.equals(this.dataBytes, other.getDataBytes()))) &&
this.dataLength == other.getDataLength() &&
((this.dataURI==null && other.getDataURI()==null) ||
(this.dataURI!=null &&
this.dataURI.equals(other.getDataURI()))) &&
((this.createdDate==null && other.getCreatedDate()==null) ||
(this.createdDate!=null &&
this.createdDate.equals(other.getCreatedDate()))) &&
((this.dataSourceType==null && other.getDataSourceType()==null) ||
(this.dataSourceType!=null &&
this.dataSourceType.equals(other.getDataSourceType()))) &&
((this.outputFormat==null && other.getOutputFormat()==null) ||
(this.outputFormat!=null &&
this.outputFormat.equals(other.getOutputFormat())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
if (getDataBytes() != null) {
for (int i=0;
i<java.lang.reflect.Array.getLength(getDataBytes());
i++) {
java.lang.Object obj = java.lang.reflect.Array.get(getDataBytes(), i);
if (obj != null &&
!obj.getClass().isArray()) {
_hashCode += obj.hashCode();
}
}
}
_hashCode += new Long(getDataLength()).hashCode();
if (getDataURI() != null) {
_hashCode += getDataURI().hashCode();
}
if (getCreatedDate() != null) {
_hashCode += getCreatedDate().hashCode();
}
if (getDataSourceType() != null) {
_hashCode += getDataSourceType().hashCode();
}
if (getOutputFormat() != null) {
_hashCode += getOutputFormat().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(DataSource.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://impl.webservice.series5.g1.com", "DataSource"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("dataBytes");
elemField.setXmlName(new javax.xml.namespace.QName("", "dataBytes"));
elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "base64Binary"));
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("dataLength");
elemField.setXmlName(new javax.xml.namespace.QName("", "dataLength"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"));
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("dataURI");
elemField.setXmlName(new javax.xml.namespace.QName("", "dataURI"));
elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("createdDate");
elemField.setXmlName(new javax.xml.namespace.QName("", "createdDate"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"));
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("dataSourceType");
elemField.setXmlName(new javax.xml.namespace.QName("", "dataSourceType"));
elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("outputFormat");
elemField.setXmlName(new javax.xml.namespace.QName("", "outputFormat"));
elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
/**
* @param role
*/
public void addRole(Role role) {
rolesSet.add(role);
}
public void removeRole(Role role) {
rolesSet.remove(role);
}
public boolean hasPrintJobs(){
if((printJobsSet != null) || (printJobsSet.size()>0)){
System.out.println("return fale");
return false;
}
System.out.println("return true");
return true;
}
}
The problem I am having is...when I try to insert records in the table, it i returning id as 1. but in the database it is storing very very lengthy id (sometimes as big as 104 digits!!!!!) . I would not have bothered about how it is stored in the database. But when i try to create the records next time i am getting the following exception
java.sql.SQLException: Overflow Exception
at oracle.sql.NUMBER.toLong(NUMBER.java:376)
at oracle.jdbc.dbaccess.DBConversion.NumberBytesToLong(DBConversion.java:2915)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4562)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:555)
at net.sf.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:69)
at net.sf.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:42)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at org.springframework.orm.hibernate.HibernateTemplate$11.doInHibernate(HibernateTemplate.java:301)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:176)
at org.springframework.orm.hibernate.HibernateTemplate.save(HibernateTemplate.java:298)
at com.test.webservice.dao.ProductionDAO.createDataSource(ProductionDAO.java:88)
at com.test.webservice.ProductionServiceImpl.createDataSource(ProductionServiceImpl.java:791)
at com.test.webservice.ProductionServiceImpl.main(ProductionServiceImpl.java:1494)
- Unable to translate SQLException with errorCode '0', will now try the fallback translator
- Translating SQLException with SQLState 'null' and errorCode '0' and message [Overflow Exception]; SQL was [] for task [Hibernate operation]
Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: (Hibernate operation): encountered SQLException [Overflow Exception]; nested exception is java.sql.SQLException: Overflow Exception
java.sql.SQLException: Overflow Exception
at oracle.sql.NUMBER.toLong(NUMBER.java:376)
at oracle.jdbc.dbaccess.DBConversion.NumberBytesToLong(DBConversion.java:2915)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4562)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:555)
at net.sf.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:69)
at net.sf.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:42)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at org.springframework.orm.hibernate.HibernateTemplate$11.doInHibernate(HibernateTemplate.java:301)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:176)
at org.springframework.orm.hibernate.HibernateTemplate.save(HibernateTemplate.java:298)
at com.test.webservice.dao.ProductionDAO.createDataSource(ProductionDAO.java:88)
at com.test.webservice.ProductionServiceImpl.createDataSource(ProductionServiceImpl.java:791)
at com.test.webservice.ProductionServiceImpl.main(ProductionServiceImpl.java:1494)
Following is the code i am using for creating a record..
Code:
public void createDataSource(DataSource dataSource) throws DataAccessException {
getHibernateTemplate().save(dataSource);
System.out.println(dataSource.getId());
}