hibernate annnotation @talbe( name = "xxx") have error in eclipse

本文解决了一个关于JPA和Hibernate注解冲突的问题。在一个项目中使用了同名但不同包的注解导致编译错误。文章解释了JPA和Hibernate注解的区别,并提供了修正代码的方法。

本来在另一个项目用的好好的代码段
在新项目就出错了。 查了一下才知道 有两个同名的annotation的,我用错了

http://stackoverflow.com/questions/5719571/what-am-i-missing-for-using-hibernate-annotation


There are two sets of persistence annotations (@Entity and @Table) - JPA annotations (in package javax.persistence) and Hibernate annotations (in package org.hibernate.annotations). Note that example uses JPA annotations, whereas your code uses Hibernate annotations, so your code doesn't compile because these annotations have different sets of attributes.
So, you need to change packages in your import statements.
Usually you should use JPA annotations unless you need some features provided only by Hibernate annotations.

转载于:https://www.cnblogs.com/johnsonshu/archive/2012/06/28/2568445.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值