在 hbm文件里配置<column name="id"/> id一定要大写吗?
<propertyname="id"><columnname="ID"/>//name里的id一定要大写吗?</property>如果表中已确定id为主键<idname=...
<property name="id">
<column name="ID" />//name里的id一定要大写吗?
</property>
如果表中已确定id为主键
<id name="id">
<column name="id" precision="8" scale="0" />
<generator class="assigned" />//这里应该怎么配置
</id> 展开
<column name="ID" />//name里的id一定要大写吗?
</property>
如果表中已确定id为主键
<id name="id">
<column name="id" precision="8" scale="0" />
<generator class="assigned" />//这里应该怎么配置
</id> 展开
1个回答
展开全部
你好,在hibernate.cfg.xml映射文件里面写的是实体类与表的映射,属性与字段的映射。而<column name>就是表字段的名字,也就是说,你表里的字段名字是什么,你的name就写什么,不分大小写。下面是个例子,你好好看下,uuid是自动生成。(Oracle)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="org.ijob.bean.SendRecord" table="ijob_SendRecord">
<!-- 联合主键 -->
<id name="id">
<generator class="uuid"></generator>
</id>
<property name="sendDay" />
<many-to-one name="position" class="org.ijob.bean.Position">
<column name="position_id"></column>
</many-to-one>
<many-to-one name="resume" class="org.ijob.bean.Resume">
<column name="resume_id"></column>
</many-to-one>
</class>
</hibernate-mapping>
如果可以就采纳我吧
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="org.ijob.bean.SendRecord" table="ijob_SendRecord">
<!-- 联合主键 -->
<id name="id">
<generator class="uuid"></generator>
</id>
<property name="sendDay" />
<many-to-one name="position" class="org.ijob.bean.Position">
<column name="position_id"></column>
</many-to-one>
<many-to-one name="resume" class="org.ijob.bean.Resume">
<column name="resume_id"></column>
</many-to-one>
</class>
</hibernate-mapping>
如果可以就采纳我吧
追问
这个是自动生成的?
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询