-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Need help in Mapping
PostPosted: Thu Sep 07, 2006 6:13 am 
Newbie

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.