Caused by:HibernateException: createCriteria is not valid without active transaction at org.hibernate.context.internal.ThreadLocalSessionContext
Caused by: org.hibernate.HibernateException: createCriteria is not
valid without active transaction at
org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:352)
at com.sun.proxy.$Proxy63.createCriteria(Unknown Source)
Hibernate Configuration
package com.cm;
import java.util.Properties;
import javax.sql.DataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate4.HibernateTemplate;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
@PropertySource("classpath:config.properties")
@ComponentScan(basePackages = "com.cm")
public class HibernateConfiguration
@Value("$db.username")
private String userName;
@Value("$db.password")
private String password;
@Value("$db.jdbcurl")
private String jdbcurl;
/*@Value("$hibernate.dialect")
private String dialect;*/
/*@Value("$hibernate.show_sql")
private String show_sql;
@Value("$hibernate.format_sql")
private String format_sql;
*/
@Bean
public LocalSessionFactoryBean sessionFactory()
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setPackagesToScan(new String "com.cm.models" );
sessionFactory.setHibernateProperties(hibernateProperties());
return sessionFactory;
@Bean
public DataSource dataSource()
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl(jdbcurl);
dataSource.setUsername(userName);
dataSource.setPassword(password);
return dataSource;
private Properties hibernateProperties()
Properties properties = new Properties();
properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
properties.put("hibernate.show_sql", true);
properties.put("hibernate.format_sql", true);
return properties;
@Bean
@Autowired
public HibernateTemplate getHibernateTemplate(SessionFactory sessionFactory)
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
return hibernateTemplate;
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s)
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
return txManager;
@Service
public class TransactionService
private TransactionDao transactionDao;
private TransactionDetailsDao transactionDetailDao;
@Autowired
public TransactionService(TransactionDao transactionDao, TransactionDetailsDao transactionDetailDao)
this.transactionDao = transactionDao;
this.transactionDetailDao = transactionDetailDao;
transactionDao.selectFromTransaction(bookRoomsRequest.getConfirmationNo(), bookRoomsRequest.getBookingStatus());
**DAO**
If i am writing @Transectional then i am getting bean creation issue
at application start up i applied on service layer also but same
issue.
@Repository
public class TransactionDaoImpl extends AbstractDao implements TransactionDao
@SuppressWarnings("unchecked")
@Override
public boolean selectFromTransaction(String orderId, String type) throws SQLException
/*
* String SQL_QUERY = "select * from transaction t where t.type = '" + type +
* "' and t.order_id='" + orderId +"';";
*/
List<Transaction> list = new ArrayList<>();
boolean response = false;
try
Criteria criteria = getSession().createCriteria(Transaction.class);
Criterion Type = (Restrictions.eq("type", type));
Criterion Order_id = (Restrictions.eq("order_id", orderId));
criteria.add(Restrictions.and(Type, Order_id));
list = criteria.list();
if (!CollectionUtils.isEmpty(list))
response = true;
catch (Exception e)
e.printStackTrace();
throw e;
return response;
if i am removing ThreadLocalSessionContext
from hibernate configuration
then i am getting below error.
org.hibernate.HibernateException: Could not obtain
transaction-synchronized Session for current thread at
org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:134)
I am managing transaction properly and i tried all possibles solution(Spring Hibernate - Could not obtain transaction-synchronized Session for current thread) still no luck please help to get the exact solution for this issue.
**On Putting @Transectional on on selectFromTransaction method i am getting below erro Stacktrace at application statup.**
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'retryServiceImpl' defined in file [/home/saurabhsharma/Desktop/fresh_proxycm/hotels-proxy-cm/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/cm-proxy-api/WEB-INF/classes/com/paytm/cm/services/impl/RetryServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: ; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:187) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1213) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1053) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1018) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:834) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
... 24 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1403) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1056) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1018) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:834) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
... 39 common frames omitted
Nov 16, 2018 11:40:53 AM org.apache.c
java spring hibernate spring-mvc
add a comment |
Caused by: org.hibernate.HibernateException: createCriteria is not
valid without active transaction at
org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:352)
at com.sun.proxy.$Proxy63.createCriteria(Unknown Source)
Hibernate Configuration
package com.cm;
import java.util.Properties;
import javax.sql.DataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate4.HibernateTemplate;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
@PropertySource("classpath:config.properties")
@ComponentScan(basePackages = "com.cm")
public class HibernateConfiguration
@Value("$db.username")
private String userName;
@Value("$db.password")
private String password;
@Value("$db.jdbcurl")
private String jdbcurl;
/*@Value("$hibernate.dialect")
private String dialect;*/
/*@Value("$hibernate.show_sql")
private String show_sql;
@Value("$hibernate.format_sql")
private String format_sql;
*/
@Bean
public LocalSessionFactoryBean sessionFactory()
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setPackagesToScan(new String "com.cm.models" );
sessionFactory.setHibernateProperties(hibernateProperties());
return sessionFactory;
@Bean
public DataSource dataSource()
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl(jdbcurl);
dataSource.setUsername(userName);
dataSource.setPassword(password);
return dataSource;
private Properties hibernateProperties()
Properties properties = new Properties();
properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
properties.put("hibernate.show_sql", true);
properties.put("hibernate.format_sql", true);
return properties;
@Bean
@Autowired
public HibernateTemplate getHibernateTemplate(SessionFactory sessionFactory)
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
return hibernateTemplate;
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s)
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
return txManager;
@Service
public class TransactionService
private TransactionDao transactionDao;
private TransactionDetailsDao transactionDetailDao;
@Autowired
public TransactionService(TransactionDao transactionDao, TransactionDetailsDao transactionDetailDao)
this.transactionDao = transactionDao;
this.transactionDetailDao = transactionDetailDao;
transactionDao.selectFromTransaction(bookRoomsRequest.getConfirmationNo(), bookRoomsRequest.getBookingStatus());
**DAO**
If i am writing @Transectional then i am getting bean creation issue
at application start up i applied on service layer also but same
issue.
@Repository
public class TransactionDaoImpl extends AbstractDao implements TransactionDao
@SuppressWarnings("unchecked")
@Override
public boolean selectFromTransaction(String orderId, String type) throws SQLException
/*
* String SQL_QUERY = "select * from transaction t where t.type = '" + type +
* "' and t.order_id='" + orderId +"';";
*/
List<Transaction> list = new ArrayList<>();
boolean response = false;
try
Criteria criteria = getSession().createCriteria(Transaction.class);
Criterion Type = (Restrictions.eq("type", type));
Criterion Order_id = (Restrictions.eq("order_id", orderId));
criteria.add(Restrictions.and(Type, Order_id));
list = criteria.list();
if (!CollectionUtils.isEmpty(list))
response = true;
catch (Exception e)
e.printStackTrace();
throw e;
return response;
if i am removing ThreadLocalSessionContext
from hibernate configuration
then i am getting below error.
org.hibernate.HibernateException: Could not obtain
transaction-synchronized Session for current thread at
org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:134)
I am managing transaction properly and i tried all possibles solution(Spring Hibernate - Could not obtain transaction-synchronized Session for current thread) still no luck please help to get the exact solution for this issue.
**On Putting @Transectional on on selectFromTransaction method i am getting below erro Stacktrace at application statup.**
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'retryServiceImpl' defined in file [/home/saurabhsharma/Desktop/fresh_proxycm/hotels-proxy-cm/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/cm-proxy-api/WEB-INF/classes/com/paytm/cm/services/impl/RetryServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: ; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:187) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1213) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1053) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1018) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:834) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
... 24 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1403) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1056) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1018) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:834) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
... 39 common frames omitted
Nov 16, 2018 11:40:53 AM org.apache.c
java spring hibernate spring-mvc
1
Judging from the exception you aren't managing transactions properly, else you wouldn't get the exceptions you are having. Post some code and configuration with your question, currently there is too little information.
– M. Deinum
Nov 15 '18 at 23:06
annotate selectFromTransaction method with @Transactional
– Alien
Nov 16 '18 at 4:56
1
You would need to begin transaction or annotate the class with@Transactional
. Post the stacktrace for If i am writing @Transectional then i am getting bean creation issue at application start up i applied on service layer also but same issue
– secret super star
Nov 16 '18 at 5:31
add a comment |
Caused by: org.hibernate.HibernateException: createCriteria is not
valid without active transaction at
org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:352)
at com.sun.proxy.$Proxy63.createCriteria(Unknown Source)
Hibernate Configuration
package com.cm;
import java.util.Properties;
import javax.sql.DataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate4.HibernateTemplate;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
@PropertySource("classpath:config.properties")
@ComponentScan(basePackages = "com.cm")
public class HibernateConfiguration
@Value("$db.username")
private String userName;
@Value("$db.password")
private String password;
@Value("$db.jdbcurl")
private String jdbcurl;
/*@Value("$hibernate.dialect")
private String dialect;*/
/*@Value("$hibernate.show_sql")
private String show_sql;
@Value("$hibernate.format_sql")
private String format_sql;
*/
@Bean
public LocalSessionFactoryBean sessionFactory()
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setPackagesToScan(new String "com.cm.models" );
sessionFactory.setHibernateProperties(hibernateProperties());
return sessionFactory;
@Bean
public DataSource dataSource()
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl(jdbcurl);
dataSource.setUsername(userName);
dataSource.setPassword(password);
return dataSource;
private Properties hibernateProperties()
Properties properties = new Properties();
properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
properties.put("hibernate.show_sql", true);
properties.put("hibernate.format_sql", true);
return properties;
@Bean
@Autowired
public HibernateTemplate getHibernateTemplate(SessionFactory sessionFactory)
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
return hibernateTemplate;
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s)
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
return txManager;
@Service
public class TransactionService
private TransactionDao transactionDao;
private TransactionDetailsDao transactionDetailDao;
@Autowired
public TransactionService(TransactionDao transactionDao, TransactionDetailsDao transactionDetailDao)
this.transactionDao = transactionDao;
this.transactionDetailDao = transactionDetailDao;
transactionDao.selectFromTransaction(bookRoomsRequest.getConfirmationNo(), bookRoomsRequest.getBookingStatus());
**DAO**
If i am writing @Transectional then i am getting bean creation issue
at application start up i applied on service layer also but same
issue.
@Repository
public class TransactionDaoImpl extends AbstractDao implements TransactionDao
@SuppressWarnings("unchecked")
@Override
public boolean selectFromTransaction(String orderId, String type) throws SQLException
/*
* String SQL_QUERY = "select * from transaction t where t.type = '" + type +
* "' and t.order_id='" + orderId +"';";
*/
List<Transaction> list = new ArrayList<>();
boolean response = false;
try
Criteria criteria = getSession().createCriteria(Transaction.class);
Criterion Type = (Restrictions.eq("type", type));
Criterion Order_id = (Restrictions.eq("order_id", orderId));
criteria.add(Restrictions.and(Type, Order_id));
list = criteria.list();
if (!CollectionUtils.isEmpty(list))
response = true;
catch (Exception e)
e.printStackTrace();
throw e;
return response;
if i am removing ThreadLocalSessionContext
from hibernate configuration
then i am getting below error.
org.hibernate.HibernateException: Could not obtain
transaction-synchronized Session for current thread at
org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:134)
I am managing transaction properly and i tried all possibles solution(Spring Hibernate - Could not obtain transaction-synchronized Session for current thread) still no luck please help to get the exact solution for this issue.
**On Putting @Transectional on on selectFromTransaction method i am getting below erro Stacktrace at application statup.**
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'retryServiceImpl' defined in file [/home/saurabhsharma/Desktop/fresh_proxycm/hotels-proxy-cm/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/cm-proxy-api/WEB-INF/classes/com/paytm/cm/services/impl/RetryServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: ; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:187) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1213) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1053) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1018) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:834) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
... 24 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1403) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1056) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1018) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:834) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
... 39 common frames omitted
Nov 16, 2018 11:40:53 AM org.apache.c
java spring hibernate spring-mvc
Caused by: org.hibernate.HibernateException: createCriteria is not
valid without active transaction at
org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:352)
at com.sun.proxy.$Proxy63.createCriteria(Unknown Source)
Hibernate Configuration
package com.cm;
import java.util.Properties;
import javax.sql.DataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate4.HibernateTemplate;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
@PropertySource("classpath:config.properties")
@ComponentScan(basePackages = "com.cm")
public class HibernateConfiguration
@Value("$db.username")
private String userName;
@Value("$db.password")
private String password;
@Value("$db.jdbcurl")
private String jdbcurl;
/*@Value("$hibernate.dialect")
private String dialect;*/
/*@Value("$hibernate.show_sql")
private String show_sql;
@Value("$hibernate.format_sql")
private String format_sql;
*/
@Bean
public LocalSessionFactoryBean sessionFactory()
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setPackagesToScan(new String "com.cm.models" );
sessionFactory.setHibernateProperties(hibernateProperties());
return sessionFactory;
@Bean
public DataSource dataSource()
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl(jdbcurl);
dataSource.setUsername(userName);
dataSource.setPassword(password);
return dataSource;
private Properties hibernateProperties()
Properties properties = new Properties();
properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
properties.put("hibernate.show_sql", true);
properties.put("hibernate.format_sql", true);
return properties;
@Bean
@Autowired
public HibernateTemplate getHibernateTemplate(SessionFactory sessionFactory)
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
return hibernateTemplate;
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s)
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
return txManager;
@Service
public class TransactionService
private TransactionDao transactionDao;
private TransactionDetailsDao transactionDetailDao;
@Autowired
public TransactionService(TransactionDao transactionDao, TransactionDetailsDao transactionDetailDao)
this.transactionDao = transactionDao;
this.transactionDetailDao = transactionDetailDao;
transactionDao.selectFromTransaction(bookRoomsRequest.getConfirmationNo(), bookRoomsRequest.getBookingStatus());
**DAO**
If i am writing @Transectional then i am getting bean creation issue
at application start up i applied on service layer also but same
issue.
@Repository
public class TransactionDaoImpl extends AbstractDao implements TransactionDao
@SuppressWarnings("unchecked")
@Override
public boolean selectFromTransaction(String orderId, String type) throws SQLException
/*
* String SQL_QUERY = "select * from transaction t where t.type = '" + type +
* "' and t.order_id='" + orderId +"';";
*/
List<Transaction> list = new ArrayList<>();
boolean response = false;
try
Criteria criteria = getSession().createCriteria(Transaction.class);
Criterion Type = (Restrictions.eq("type", type));
Criterion Order_id = (Restrictions.eq("order_id", orderId));
criteria.add(Restrictions.and(Type, Order_id));
list = criteria.list();
if (!CollectionUtils.isEmpty(list))
response = true;
catch (Exception e)
e.printStackTrace();
throw e;
return response;
if i am removing ThreadLocalSessionContext
from hibernate configuration
then i am getting below error.
org.hibernate.HibernateException: Could not obtain
transaction-synchronized Session for current thread at
org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:134)
I am managing transaction properly and i tried all possibles solution(Spring Hibernate - Could not obtain transaction-synchronized Session for current thread) still no luck please help to get the exact solution for this issue.
**On Putting @Transectional on on selectFromTransaction method i am getting below erro Stacktrace at application statup.**
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'retryServiceImpl' defined in file [/home/saurabhsharma/Desktop/fresh_proxycm/hotels-proxy-cm/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/cm-proxy-api/WEB-INF/classes/com/paytm/cm/services/impl/RetryServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: ; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:187) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1213) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1053) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1018) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:834) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
... 24 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.paytm.cm.dao.impl.TransactionDaoImpl] found for dependency [com.paytm.cm.dao.impl.TransactionDaoImpl]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1403) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1056) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1018) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:834) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
... 39 common frames omitted
Nov 16, 2018 11:40:53 AM org.apache.c
java spring hibernate spring-mvc
java spring hibernate spring-mvc
edited Nov 16 '18 at 7:08
user3389133
asked Nov 15 '18 at 22:50
user3389133user3389133
13
13
1
Judging from the exception you aren't managing transactions properly, else you wouldn't get the exceptions you are having. Post some code and configuration with your question, currently there is too little information.
– M. Deinum
Nov 15 '18 at 23:06
annotate selectFromTransaction method with @Transactional
– Alien
Nov 16 '18 at 4:56
1
You would need to begin transaction or annotate the class with@Transactional
. Post the stacktrace for If i am writing @Transectional then i am getting bean creation issue at application start up i applied on service layer also but same issue
– secret super star
Nov 16 '18 at 5:31
add a comment |
1
Judging from the exception you aren't managing transactions properly, else you wouldn't get the exceptions you are having. Post some code and configuration with your question, currently there is too little information.
– M. Deinum
Nov 15 '18 at 23:06
annotate selectFromTransaction method with @Transactional
– Alien
Nov 16 '18 at 4:56
1
You would need to begin transaction or annotate the class with@Transactional
. Post the stacktrace for If i am writing @Transectional then i am getting bean creation issue at application start up i applied on service layer also but same issue
– secret super star
Nov 16 '18 at 5:31
1
1
Judging from the exception you aren't managing transactions properly, else you wouldn't get the exceptions you are having. Post some code and configuration with your question, currently there is too little information.
– M. Deinum
Nov 15 '18 at 23:06
Judging from the exception you aren't managing transactions properly, else you wouldn't get the exceptions you are having. Post some code and configuration with your question, currently there is too little information.
– M. Deinum
Nov 15 '18 at 23:06
annotate selectFromTransaction method with @Transactional
– Alien
Nov 16 '18 at 4:56
annotate selectFromTransaction method with @Transactional
– Alien
Nov 16 '18 at 4:56
1
1
You would need to begin transaction or annotate the class with
@Transactional
. Post the stacktrace for If i am writing @Transectional then i am getting bean creation issue at application start up i applied on service layer also but same issue– secret super star
Nov 16 '18 at 5:31
You would need to begin transaction or annotate the class with
@Transactional
. Post the stacktrace for If i am writing @Transectional then i am getting bean creation issue at application start up i applied on service layer also but same issue– secret super star
Nov 16 '18 at 5:31
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328981%2fcaused-byhibernateexception-createcriteria-is-not-valid-without-active-transac%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328981%2fcaused-byhibernateexception-createcriteria-is-not-valid-without-active-transac%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Judging from the exception you aren't managing transactions properly, else you wouldn't get the exceptions you are having. Post some code and configuration with your question, currently there is too little information.
– M. Deinum
Nov 15 '18 at 23:06
annotate selectFromTransaction method with @Transactional
– Alien
Nov 16 '18 at 4:56
1
You would need to begin transaction or annotate the class with
@Transactional
. Post the stacktrace for If i am writing @Transectional then i am getting bean creation issue at application start up i applied on service layer also but same issue– secret super star
Nov 16 '18 at 5:31