JAVA-143: Migrate spring-hibernate-3 to com.baeldung
This commit is contained in:
parent
733402b709
commit
233891c107
@ -4,8 +4,8 @@ This module contains articles about Spring with Hibernate 3
|
|||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
|
|
||||||
- [Hibernate 3 with Spring](http://www.baeldung.com/hibernate3-spring)
|
- [Hibernate 3 with Spring](https://www.baeldung.com/hibernate3-spring)
|
||||||
- [HibernateException: No Hibernate Session Bound to Thread in Hibernate 3](http://www.baeldung.com/no-hibernate-session-bound-to-thread-exception)
|
- [HibernateException: No Hibernate Session Bound to Thread in Hibernate 3](https://www.baeldung.com/no-hibernate-session-bound-to-thread-exception)
|
||||||
|
|
||||||
### Quick Start
|
### Quick Start
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package org.baeldung.persistence.dao;
|
package com.baeldung.persistence.dao;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,18 +1,18 @@
|
|||||||
package org.baeldung.persistence.dao;
|
package com.baeldung.persistence.dao;
|
||||||
|
|
||||||
|
|
||||||
import org.baeldung.persistence.model.Event;
|
import com.baeldung.persistence.model.Event;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class EventDao extends AbstractHibernateDao<Event> implements IEventDao {
|
public class EventDao extends AbstractHibernateDao<Event> implements IEventDao {
|
||||||
|
|
||||||
public EventDao() {
|
public EventDao() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
setClazz(Event.class);
|
setClazz(Event.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// API
|
// API
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package org.baeldung.persistence.dao;
|
package com.baeldung.persistence.dao;
|
||||||
|
|
||||||
import org.baeldung.persistence.model.Foo;
|
import com.baeldung.persistence.model.Foo;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.baeldung.persistence.dao;
|
||||||
|
|
||||||
|
import com.baeldung.persistence.model.Event;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IEventDao extends IOperations<Event> {
|
||||||
|
//
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.baeldung.persistence.dao;
|
||||||
|
|
||||||
|
import com.baeldung.persistence.model.Foo;
|
||||||
|
|
||||||
|
public interface IFooDao extends IOperations<Foo> {
|
||||||
|
//
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.baeldung.persistence.dao;
|
package com.baeldung.persistence.dao;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,45 +1,45 @@
|
|||||||
package org.baeldung.persistence.model;
|
package com.baeldung.persistence.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "EVENTS")
|
@Table(name = "EVENTS")
|
||||||
public class Event implements Serializable {
|
public class Event implements Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public Event() {
|
public Event() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Event(String description) {
|
public Event(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.baeldung.persistence.model;
|
package com.baeldung.persistence.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -1,27 +1,27 @@
|
|||||||
package org.baeldung.persistence.service;
|
package com.baeldung.persistence.service;
|
||||||
|
|
||||||
|
|
||||||
import org.baeldung.persistence.dao.IEventDao;
|
import com.baeldung.persistence.model.Event;
|
||||||
import org.baeldung.persistence.model.Event;
|
import com.baeldung.persistence.dao.IEventDao;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional
|
@Transactional
|
||||||
public class EventService {
|
public class EventService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IEventDao dao;
|
private IEventDao dao;
|
||||||
|
|
||||||
public EventService() {
|
public EventService() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
// API
|
// API
|
||||||
|
|
||||||
public void create(final Event entity) {
|
public void create(final Event entity) {
|
||||||
dao.create(entity);
|
dao.create(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package org.baeldung.persistence.service;
|
package com.baeldung.persistence.service;
|
||||||
|
|
||||||
import org.baeldung.persistence.dao.IFooDao;
|
import com.baeldung.persistence.dao.IFooDao;
|
||||||
import org.baeldung.persistence.model.Foo;
|
import com.baeldung.persistence.model.Foo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
@ -1,4 +1,4 @@
|
|||||||
package org.baeldung.spring;
|
package com.baeldung.spring;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ import com.google.common.base.Preconditions;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@PropertySource({ "classpath:persistence-h2.properties" })
|
@PropertySource({ "classpath:persistence-h2.properties" })
|
||||||
@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" })
|
@ComponentScan({ "com.baeldung.persistence.dao", "com.baeldung.persistence.service" })
|
||||||
public class PersistenceConfig {
|
public class PersistenceConfig {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -36,7 +36,7 @@ public class PersistenceConfig {
|
|||||||
public AnnotationSessionFactoryBean sessionFactory() {
|
public AnnotationSessionFactoryBean sessionFactory() {
|
||||||
final AnnotationSessionFactoryBean sessionFactory = new AnnotationSessionFactoryBean();
|
final AnnotationSessionFactoryBean sessionFactory = new AnnotationSessionFactoryBean();
|
||||||
sessionFactory.setDataSource(dataSource());
|
sessionFactory.setDataSource(dataSource());
|
||||||
sessionFactory.setPackagesToScan(new String[] { "org.baeldung.persistence.model" });
|
sessionFactory.setPackagesToScan(new String[] { "com.baeldung.persistence.model" });
|
||||||
sessionFactory.setHibernateProperties(hibernateProperties());
|
sessionFactory.setHibernateProperties(hibernateProperties());
|
||||||
|
|
||||||
return sessionFactory;
|
return sessionFactory;
|
@ -1,4 +1,4 @@
|
|||||||
package org.baeldung.spring;
|
package com.baeldung.spring;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ import com.google.common.base.Preconditions;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@PropertySource({ "classpath:persistence-h2.properties" })
|
@PropertySource({ "classpath:persistence-h2.properties" })
|
||||||
@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" })
|
@ComponentScan({ "com.baeldung.persistence.dao", "com.baeldung.persistence.service" })
|
||||||
public class PersistenceConfigHibernate3 {
|
public class PersistenceConfigHibernate3 {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
@ -1,4 +1,4 @@
|
|||||||
package org.baeldung.spring;
|
package com.baeldung.spring;
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.ImportResource;
|
import org.springframework.context.annotation.ImportResource;
|
||||||
@ -6,7 +6,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
|
|
||||||
// @Configuration
|
// @Configuration
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" })
|
@ComponentScan({ "com.baeldung.persistence.dao", "com.baeldung.persistence.service" })
|
||||||
@ImportResource({ "classpath:persistenceConfig.xml" })
|
@ImportResource({ "classpath:persistenceConfig.xml" })
|
||||||
public class PersistenceXmlConfig {
|
public class PersistenceXmlConfig {
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
package org.baeldung.persistence.dao;
|
|
||||||
|
|
||||||
import org.baeldung.persistence.model.Event;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface IEventDao extends IOperations<Event> {
|
|
||||||
//
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package org.baeldung.persistence.dao;
|
|
||||||
|
|
||||||
import org.baeldung.persistence.model.Foo;
|
|
||||||
|
|
||||||
public interface IFooDao extends IOperations<Foo> {
|
|
||||||
//
|
|
||||||
}
|
|
@ -4,6 +4,6 @@
|
|||||||
"http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
|
"http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
|
||||||
<hibernate-configuration>
|
<hibernate-configuration>
|
||||||
<session-factory>
|
<session-factory>
|
||||||
<mapping class="org.baeldung.persistence.model.Event" />
|
<mapping class="com.baeldung.persistence.model.Event" />
|
||||||
</session-factory>
|
</session-factory>
|
||||||
</hibernate-configuration>
|
</hibernate-configuration>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||||
|
|
||||||
<context:annotation-config />
|
<context:annotation-config />
|
||||||
<context:component-scan base-package="org.baeldung.persistence" />
|
<context:component-scan base-package="com.baeldung.persistence" />
|
||||||
<context:property-placeholder location="classpath:persistence-h2.properties"/>
|
<context:property-placeholder location="classpath:persistence-h2.properties"/>
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
|
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
|
||||||
<property name="dataSource" ref="dataSource"/>
|
<property name="dataSource" ref="dataSource"/>
|
||||||
<property name="packagesToScan" value="org.baeldung.persistence.model"/>
|
<property name="packagesToScan" value="com.baeldung.persistence.model"/>
|
||||||
<property name="hibernateProperties">
|
<property name="hibernateProperties">
|
||||||
<props>
|
<props>
|
||||||
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
|
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</context-param>
|
</context-param>
|
||||||
<context-param>
|
<context-param>
|
||||||
<param-name>contextConfigLocation</param-name>
|
<param-name>contextConfigLocation</param-name>
|
||||||
<param-value>org.baeldung.spring</param-value>
|
<param-value>com.baeldung.spring</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
<listener>
|
<listener>
|
||||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.baeldung;
|
package com.baeldung;
|
||||||
|
|
||||||
import org.baeldung.spring.PersistenceConfig;
|
import com.baeldung.spring.PersistenceConfig;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
@ -1,10 +1,9 @@
|
|||||||
package org.baeldung.persistence.service;
|
package com.baeldung.persistence.service;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
|
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
|
||||||
|
|
||||||
import org.baeldung.persistence.model.Foo;
|
import com.baeldung.spring.PersistenceConfig;
|
||||||
import org.baeldung.persistence.service.FooService;
|
import com.baeldung.persistence.model.Foo;
|
||||||
import org.baeldung.spring.PersistenceConfig;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
@ -1,7 +1,7 @@
|
|||||||
package org.baeldung.persistence.service;
|
package com.baeldung.persistence.service;
|
||||||
|
|
||||||
import org.baeldung.persistence.model.Event;
|
import com.baeldung.persistence.model.Event;
|
||||||
import org.baeldung.spring.PersistenceConfigHibernate3;
|
import com.baeldung.spring.PersistenceConfigHibernate3;
|
||||||
import org.hamcrest.core.IsInstanceOf;
|
import org.hamcrest.core.IsInstanceOf;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
@ -1,7 +1,7 @@
|
|||||||
package org.baeldung.persistence.service;
|
package com.baeldung.persistence.service;
|
||||||
|
|
||||||
import org.baeldung.persistence.model.Event;
|
import com.baeldung.persistence.model.Event;
|
||||||
import org.baeldung.spring.PersistenceConfig;
|
import com.baeldung.spring.PersistenceConfig;
|
||||||
import org.hamcrest.core.IsInstanceOf;
|
import org.hamcrest.core.IsInstanceOf;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
@ -1,42 +1,42 @@
|
|||||||
package org.baeldung.persistence.service;
|
package com.baeldung.persistence.service;
|
||||||
|
|
||||||
import org.baeldung.persistence.model.Event;
|
import com.baeldung.persistence.model.Event;
|
||||||
import org.baeldung.spring.PersistenceXmlConfig;
|
import com.baeldung.spring.PersistenceXmlConfig;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.orm.hibernate3.HibernateSystemException;
|
import org.springframework.orm.hibernate3.HibernateSystemException;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||||
|
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration(classes = { PersistenceXmlConfig.class }, loader = AnnotationConfigContextLoader.class)
|
@ContextConfiguration(classes = { PersistenceXmlConfig.class }, loader = AnnotationConfigContextLoader.class)
|
||||||
public class NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest {
|
public class NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
EventService service;
|
EventService service;
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public ExpectedException expectedEx = ExpectedException.none();
|
public ExpectedException expectedEx = ExpectedException.none();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public final void whenEntityIsCreated_thenNoExceptions() {
|
public final void whenEntityIsCreated_thenNoExceptions() {
|
||||||
service.create(new Event("from Annotation Session Bean Factory"));
|
service.create(new Event("from Annotation Session Bean Factory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
public final void whenNoTransBoundToSession_thenException() {
|
public final void whenNoTransBoundToSession_thenException() {
|
||||||
expectedEx.expect(HibernateSystemException.class);
|
expectedEx.expect(HibernateSystemException.class);
|
||||||
expectedEx.expectMessage("No Hibernate Session bound to thread, "
|
expectedEx.expectMessage("No Hibernate Session bound to thread, "
|
||||||
+ "and configuration does not allow creation of "
|
+ "and configuration does not allow creation of "
|
||||||
+ "non-transactional one here");
|
+ "non-transactional one here");
|
||||||
service.create(new Event("from Annotation Session Bean Factory"));
|
service.create(new Event("from Annotation Session Bean Factory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,39 +1,38 @@
|
|||||||
package org.baeldung.persistence.service;
|
package com.baeldung.persistence.service;
|
||||||
|
|
||||||
import org.baeldung.persistence.model.Event;
|
import com.baeldung.persistence.model.Event;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.orm.hibernate3.HibernateSystemException;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@ContextConfiguration(locations = { "classpath:exceptionDemoPersistenceConfig.xml" })
|
||||||
@ContextConfiguration(locations = { "classpath:exceptionDemoPersistenceConfig.xml" })
|
public class NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest {
|
||||||
public class NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest {
|
|
||||||
|
@Autowired
|
||||||
@Autowired
|
EventService service;
|
||||||
EventService service;
|
|
||||||
|
@Rule
|
||||||
@Rule
|
public ExpectedException expectedEx = ExpectedException.none();
|
||||||
public ExpectedException expectedEx = ExpectedException.none();
|
|
||||||
|
@Test
|
||||||
@Test
|
public final void whenEntityIsCreated_thenNoExceptions() {
|
||||||
public final void whenEntityIsCreated_thenNoExceptions() {
|
service.create(new Event("from local session bean factory"));
|
||||||
service.create(new Event("from local session bean factory"));
|
}
|
||||||
}
|
|
||||||
|
@Test
|
||||||
@Test
|
@Ignore
|
||||||
@Ignore
|
public final void whenNoTransBoundToSession_thenException() {
|
||||||
public final void whenNoTransBoundToSession_thenException() {
|
expectedEx.expect(HibernateException.class);
|
||||||
expectedEx.expect(HibernateException.class);
|
expectedEx.expectMessage("No Hibernate Session bound to thread, "
|
||||||
expectedEx.expectMessage("No Hibernate Session bound to thread, "
|
+ "and configuration does not allow creation "
|
||||||
+ "and configuration does not allow creation "
|
+ "of non-transactional one here");
|
||||||
+ "of non-transactional one here");
|
service.create(new Event("from local session bean factory"));
|
||||||
service.create(new Event("from local session bean factory"));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user