有三个个表ROLE,OPERATOR,OpeToRole<hibernate-mapping>
<class name="Operator" table="OPERATOR" lazy="false">
<meta attribute="class-description">
.....................
<set name="ORM_Roles" table="OpeToRole" lazy="false" cascade="save-update" inverse="false">
<key column="Opeid" not-null="true"/>
<many-to-many column="RoleName" class="Role">
</many-to-many>
</set>
</class>
</hibernate-mapping> <hibernate-mapping>
<class name="Role" table="ROLE" lazy="false">
<meta attribute="class-description">
...........................
<set name="ORM_Operators" table="OpeToRole" lazy="false" cascade="save-update" inverse="true">
<key column="RoleName" not-null="true"/>
<many-to-many column="Opeid" class="Operator">
</many-to-many>
</set>
</class>
</hibernate-mapping>程序
先对一个Operator的实例ope赋值,
................
ope.setORM_Roles(roles);
然后调用接口OperatorDAO.update(ope);
接口OperatorDAO.update(ope)的实现是 entityManager.merge(operator)问题是,这样数据为什么不能插入关系表OpeToRole。急求
<class name="Operator" table="OPERATOR" lazy="false">
<meta attribute="class-description">
.....................
<set name="ORM_Roles" table="OpeToRole" lazy="false" cascade="save-update" inverse="false">
<key column="Opeid" not-null="true"/>
<many-to-many column="RoleName" class="Role">
</many-to-many>
</set>
</class>
</hibernate-mapping> <hibernate-mapping>
<class name="Role" table="ROLE" lazy="false">
<meta attribute="class-description">
...........................
<set name="ORM_Operators" table="OpeToRole" lazy="false" cascade="save-update" inverse="true">
<key column="RoleName" not-null="true"/>
<many-to-many column="Opeid" class="Operator">
</many-to-many>
</set>
</class>
</hibernate-mapping>程序
先对一个Operator的实例ope赋值,
................
ope.setORM_Roles(roles);
然后调用接口OperatorDAO.update(ope);
接口OperatorDAO.update(ope)的实现是 entityManager.merge(operator)问题是,这样数据为什么不能插入关系表OpeToRole。急求
解决方案 »
- 请教大家一个新手的问题
- 请问mysql最大能处理多少数据量
- 帮看看这个可以实现吗?
- spring事务??
- 小声的问一句,2.5W的代码量算多吗,一个项目多少代码量才算是多呢
- 如何把windows域帐号和客户的mis系统帐号联系在一起?登陆域同时也就登陆了系统。
- 用struts 框架后,jsp页有错误但是显示不出来。帮帮忙。。
- struts Action传参数给servlet问题
- 请问那里有sql server jdbc driver?
- 配置weblogic的问题
- you have an error in your sql syntax;check the manual
- 请教hibernate高手 啦!!!!!!!!!!!!!!!!!!!!!!!
role.getOperators.add(ope);
ROLE,表RoleName字段,RoleName为主键
OPERATOR,表OPEID....等等
OpeToRole 为ROLEID,OPEID字段对象都是是持久化对象
OpeToRole 为RoleName,Opeid字段