From: Juergen H. <jho...@us...> - 2008-10-23 17:21:48
|
Update of /cvsroot/springframework/spring/tiger/src/org/springframework/orm/jpa/vendor In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30204/tiger/src/org/springframework/orm/jpa/vendor Modified Files: HibernateJpaDialect.java Log Message: HibernateJpaDialect checks "EntityManager.getDelegate()" as well to find Hibernate Session (for Seam compatibility) Index: HibernateJpaDialect.java =================================================================== RCS file: /cvsroot/springframework/spring/tiger/src/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HibernateJpaDialect.java 8 Sep 2007 15:04:36 -0000 1.5 --- HibernateJpaDialect.java 23 Oct 2008 17:21:42 -0000 1.6 *************** *** 1,4 **** /* ! * Copyright 2002-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 99,103 **** protected Session getSession(EntityManager em) { ! return ((HibernateEntityManager) em).getSession(); } --- 99,115 ---- protected Session getSession(EntityManager em) { ! if (em instanceof HibernateEntityManager) { ! return ((HibernateEntityManager) em).getSession(); ! } ! else { ! Object delegate = em.getDelegate(); ! if (delegate instanceof Session) { ! return (Session) delegate; ! } ! else { ! throw new IllegalStateException( ! "Cannot obtain native Hibernate Session from given JPA EntityManager: " + em.getClass()); ! } ! } } |