Joined: Thu Apr 27, 2006 9:56 am Posts: 14 Location: Hyderabad
|
Hi,
I hav a doubt in Hiberante Mapping.
My Table in Oracle data base is as follows.
[b]Table Name :Data_exp[/b]
Coloumns as
Data_exp_id Integer(10)
Message Long
[b]Mapping file (.hbm.xml ) is as [/b]
<hibernate-mapping package="com.shps.sam.model">
<class table="DATA_EXCEPTION" name="DataException">
<id type="java.lang.Integer" column="DATA_EXCEPTION_ID" access="property" name="dataExceptionId">
<generator class="sequence">
<param name="sequence">DATA_EXCEPTION_ID_SQ</param>
</generator>
</id>
<property name="message" not-null="true" access="property" column="MESSAGE"/>
</class>
</hibernate-mapping>
[b]Java Object as Follows[/b]
package com.shps.sam.model;
/**
* @hibernate.mapping package="com.shps.sam.model"
* @hibernate.class name="DataException" table="DATA_EXCEPTION"
*/
abstract public class DataExceptionBase implements java.io.Serializable
{
private Integer dataExceptionId;
private String message;
public DataExceptionBase()
{
}
/**
* @hibernate.id generator-class="sequence"
* type="java.lang.Integer"
* column="DATA_EXCEPTION_ID"
* @hibernate.generator-param name="sequence"
* value="DATA_EXCEPTION_ID_SQ"
*/
public Integer getDataExceptionId()
{
return this.dataExceptionId;
}
public void setDataExceptionId(Integer dataExceptionId)
{
this.dataExceptionId = dataExceptionId;
}
public void setMessage(String message)
{
this.message = message;
}
/**
* @hibernate.property column="MESSAGE"
* not-null="true"
*/
public String getMessage()
{
return this.message;
}
}
Every thng is working Properly. But i didnt understand how a string value is allowed into filed of Long type in database.
Please Help me if any one knows the answer.
Thanks in Advance
|
|