`
m635674608
  • 浏览: 4944088 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

HibernateException: identifier of an instance of pojo.Order was altered from 23

 
阅读更多

HibernateException: identifier of an instance of pojo.Order was altered from 23 to 8

 

在项目中,通过hibernate查询了一条数据,然后把主键改掉了,,当时是在action中操作的。

由于是一个线程,在一个session中。所以。。。在hibernate缓存中,该对象还是存在的。所有就报了这个异常。

 

然后克隆了一个一模一样的对象,然后再做相应的save操作就可以了。

分享到:
评论

相关推荐

    org.hibernate.HibernateException: No Hibernate Session bound to thread

    No Hibernate Session bound to thread,没有绑定线程解决办法,找了好久才找到的

    解决SpringDataJPA报错:org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null w

    问题描述 用SpringBoot + Spring Data JPA操作数据库 项目启动的时候 报了一个错 SpringBoot的版本是2.2.6.RELEASE org.springframework.beans.factory.BeanCreationException: Error creating bean with name '...

    HIbernate4.3.6整合c3p0所需jar

    Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.hibernate.connection.C3P0ConnectionProvider] at org.hibernate.engine.jdbc.connections.internal....

    Spring4.0+Hibernate4.0+Struts2.3整合案例

    2、报错:org.hibernate.HibernateException: No Session found for current thread 意思是必须在transcation.isActive()条件下才能执行, 可以解决办法是:当方法不需要事务支持的时候,使用 Session ...

    Hibernate+Proxool配置

    由于项目需求的需要,我们引入了连接池。数据库连接池的最大好处是节省开销。我们采用了Hibernate,所以可以考虑hibernate自带的连接池机制,但是发现效率不高,而且Hibernate也推荐使用c3p0或Proxool连接池,在我们...

    Hibernate3技术精辟详解

    Hibernate3技术精辟详解 Hibernate3 Hibernate3详解,看过就知道Hibernate3怎么配置和应用

    spring_MVC源码

    -- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 --> 14. <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> 15. 16. <!-- 对模型视图名称的解析...

    Mysql数据库从5.6.28版本升到8.0.11版本部署项目时遇到的问题及解决方法

    1.Caused by: org.hibernate.HibernateException: Connection cannot be null when ‘hibernate.dialect’ not set 报错就配置吧 启动项目不报错了,但是访问项目报错了 2.访问报错...

    J2EE利用Hibernate采用B/S架构网页设计

    import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.cfg.Configuration; /** * Configures and provides access to Hibernate sessions, tied to the * current ...

    新闻发布系统

    Query query = session.createQuery("from News order by id desc"); query.setFirstResult((pb.getCurrentPageNum()-1)*pb.getPageSize()); query.setMaxResults(pb.getPageSize()); list = query....

    用户管理系统

    String hql="from User as u where u.username=? and u.userpass=? and u.userright=?"; Query query=session.createQuery(hql) ; query.setString(0, u.getUsername()); query.setString(1, u.getUserpass...

    struts hibernate spring 搞定分布式事务

    public void executeTransactionBySQL() throws HibernateException { TestJTAByOracleVo vo1=new TestJTAByOracleVo(); vo1.setName("3333333"); HibernateByOracleDAO.addByOracle(vo1); ...

    jsp Hibernate入门教程第1/3页

    例如: 代码如下:HibernateTest.java ... public class HibernateTest { public static void main(String[] args) throws HibernateException { SessionFactory sessionFactory = new Configuration().configure().bui

    数据库课程设计题目与例子

    public void deleteUsers(Users users) throws HibernateException { Session session = HibSessionFactory.currentSession(); Transaction tx = session.beginTransaction(); session.delete(users); tx....

    hibernate的事务核并发

    hibernate详细解析.pdf文档,所有的都有。。

    深入浅出Hibernate中文版 part2

    6.8 HibernateException,Checked 6.9 Template/Callback 简化业务方法 6.10 版面:一棵自身循环的树 6.11 版面与帖子:Master/Detail 主从关系 6.12 帖子树及其分页 6.13 与Web层交互 6.14 帖子的多形扩展:...

    深入浅出Hibernate中文版 part1

    6.8 HibernateException,Checked 6.9 Template/Callback 简化业务方法 6.10 版面:一棵自身循环的树 6.11 版面与帖子:Master/Detail 主从关系 6.12 帖子树及其分页 6.13 与Web层交互 6.14 帖子的多形扩展:...

Global site tag (gtag.js) - Google Analytics