chand pb
asked on
How to represent oracle composite key in hibernate
Hello,
I will create an oracle table with composite key.. How do i represent the composite key in the hibernate file and in the bean
This is my bean
hibernate file stub
Thanks for your help
I will create an oracle table with composite key.. How do i represent the composite key in the hibernate file and in the bean
CREATE TABLE FAVORITES
(
FAVORITE_ID VARCHAR2(20) NOT NULL,
TITLE VARCHAR2(200),
CITY VARCHAR2(40),
STATE_CODE VARCHAR2(40),
STATE_NAME VARCHAR2(20),
STRING VARCHAR2(100),
USERID VARCHAR2(30) NOT NULL
, CONSTRAINT FAVORITE_PK PRIMARY KEY
(
FAVORITE_ID,
USERID
)
ENABLE
)
;
This is my bean
package com.rusapi.ca.beans;
public class Favorites {
String jobId,userId;
String city,stateCode,stateName,string;
String type,postingDate;
public String getjobId(){
return this.jobId;
}
public void setId(String jobId){
this.jobId = jobId;
}
public String getUserId(){
return this.userId;
}
public void setUserId(String userId){
this.userId = userId;
}
public String getCity(){
return this.city;
}
public void setCity(String city){
this.city = city;
}
public String getStateCode(){
return this.stateCode;
}
public void setStateCode(String stateCode){
this.stateCode = stateCode;
}
public String getStateName(){
return this.stateCode;
}
public void setStateName(String stateName){
this.stateName = stateName;
}
public String getString(){
return this.string;
}
public void setString(String string){
this.string = string;
}
public String getType(){
return this.type;
}
public void setType(String type){
this.type = type;
}
public String getPostingDate(){
return this.postingDate;
}
public void setPostingDate(String postingDate){
this.postingDate = postingDate;
}
}
hibernate file stub
<?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 package="com.rusapi.ca.beans">
<class name="Favorites" table="Favorites">
<id name="" column="" />
</class>
</hibernate-mapping>
Thanks for your help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.