利用hibernate生产主键

树成 2008-07-10 03:38:03
我现在数据库中有一个函数get_seq来生成主键,在hibernate中要如何配置来使用这个函数来生产主键?
函数返回的是一个字符串
...全文
57 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjc_love 2008-07-10
  • 打赏
  • 举报
回复
要实现接口 IdentifierGenerator中的方法 generate
树成 2008-07-10
  • 打赏
  • 举报
回复
都没有解决实际问题,我是要调用get_seq函数来生成主键
pilishou 2008-07-10
  • 打赏
  • 举报
回复
<?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 " >

<hibernate-mapping package= "cn.edu.tju.kse.bean ">

<class name= "Results " table= "Results ">
<id name= "id " column= "id " type= "integer ">
<generator class= "native "/>
</id>
<property name= "titles " column= "titles " type= "string " not-null= "true " />
<property name= "files " column= "files " type= "string " not-null= "false " />
<property name= "sorts " column= "sorts " type= "string " not-null= "true " />
<property name= "userId1 " column= "userId1 " type= "string " not-null= "false " />
<property name= "userId2 " column= "userId2 " type= "string " not-null= "false " />
<property name= "userId3 " column= "userId3 " type= "string " not-null= "false " />
<property name= "isVisual " column= "isVisual " type= "int " not-null= "true " />
</class>

</hibernate-mapping>
duqiancheng 2008-07-10
  • 打赏
  • 举报
回复
sql方言指定native

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧