CSDN(高手)关于Hibernate3.0一对一主键映射问题??
我的开发环境是 myeclipse+oracle9i
我做一对一主键映射,不知道 <generator class= " " /> id 应该是什么???
我有两个表
CREATE TABLE TUSER (
USER_ID varchar(10) NOT NULL default ′′,
NAME varchar(16) NOT NULL default ′′,
PRIMARY KEY (USER_ID)
);
CREATE TABLE TROOM (
ROOM_ID varchar(10) NOT NULL default ′′,
ADDRESS varchar(32) NOT NULL default ′′,
PRIMARY KEY (ROOM_ID)
);
Tuser.hbm.xml
<?xml version= "1.0 " encoding= "utf-8 "?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN "
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd ">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name= "org.myhibernate.Tuser " table= "TUSER " schema= "SCOTT ">
<id name= "userId " type= "java.lang.String ">
<column name= "USER_ID " length= "10 " />
<generator class= "native " />
</id>
<property name= "name " type= "java.lang.String ">
<column name= "NAME " length= "50 " not-null= "true " />
</property>
<one-to-one name= "room " class= "org.myhibernate.Troom " cascade= "all "/>
</class>
</hibernate-mapping>
TRoom.hbm.xml
<?xml version= "1.0 " encoding= "utf-8 "?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN "
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd ">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name= "org.myhibernate.Troom " table= "TROOM " schema= "SCOTT ">
<id name= "roomId " type= "java.lang.String ">
<column name= "ROOM_ID " length= "10 " />
&nb