如果你是两张没有关联的表,就配置两个文件,不要建关联。直接select * from Class1,Class2 where ....否则的话就建一个主表,一个属性表。
解决方案 »
- java读取Excel时出现读取到那一空列时,它把下一列的值给读取到上一列去了,请问这是什么愿因
- 关于JSF的问题,太郁闷啦
- Struts的Validator问题,比较复杂求达人解答!
- Hibernate问题~~~session.beginTransaction()时jdbc出错~~~~
- sessionContext
- struts 问题Cannot find ActionMappings or ActionFormBeans collection
- dom4j利用xpath寻找节点出错
- [求助]socket连接出错,报SecurityException
- 触幕屏开发用什么工具啊
- EJB automatic-key-generation 问题?
- 关于URL映射
- SessionFactry为什么报错!
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="true">
<class name="Class1" table="`Class1`" mutable="true" dynamic-update="false" dynamic-insert="false" select-before-update="false" lazy="true" abstract="false">
<composite-id>
<key-property name="aaaa">
<column name="`aaaa`" sql-type="INTEGER" not-null="true"/>
</key-property>
<key-property name="dddd">
<column name="`dddd`" sql-type="INTEGER" not-null="true"/>
</key-property>
</composite-id>
<property name="bbbb" insert="true" update="true" lazy="false" optimistic-lock="true">
<column name="`bbbb`" sql-type="INTEGER"/>
</property>
<property name="ccc" insert="true" update="true" lazy="false" optimistic-lock="true">
<column name="`ccc`" sql-type="INTEGER"/>
</property>
<bag name="class2" outer-join="false" lazy="true" optimistic-lock="true">
<key>
<column name="aaa" sql-type="INTEGER" not-null="true" length="0"/>
<column name="ddd" sql-type="INTEGER" not-null="true" length="0"/>
</key>
<one-to-many class="Class2"/>
</bag>
</class>
</hibernate-mapping>
你说的第一表的dddd应该也是主键才行,试试这个这是第一个。
<!-- Hibernate XML Mapping File -->
<!-- Author: Administrator -->
<!-- Modified: 2007年1月11日 20:12:04 -->
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="true">
<class name="Class2" table="`Class2`" mutable="true" dynamic-update="false" dynamic-insert="false" select-before-update="false" lazy="true" abstract="false">
<composite-id>
<key-many-to-one name="class1" access="property">
<column name="`aaaa`" sql-type="INTEGER" not-null="true"/>
<column name="`dddd`" sql-type="INTEGER" not-null="true"/>
</key-many-to-one>
</composite-id>
<property name="cccccccccc" insert="true" update="true" lazy="false" optimistic-lock="true">
<column name="`cccccccccc`" sql-type="INTEGER"/>
</property>
<property name="bbbb" insert="true" update="true" lazy="false" optimistic-lock="true">
<column name="`bbbb`" sql-type="INTEGER"/>
</property>
</class>
</hibernate-mapping>
这是第二个,里面有些单引号需要去掉。
看看是否有帮助