-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HELP!!! Hibernate can't begin transaction.
PostPosted: Fri Jul 30, 2010 7:40 am 
Newbie

Joined: Fri Jul 30, 2010 7:31 am
Posts: 1
I am trying to develop some servlets but I have not been successful at fetching my data from mysql database. I keep getting this error

Code:
ERROR: org.hibernate.TransactionException: Transaction not successfully started


This error was caused by the following line of code.
Code:
NewHibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();


I have the following in my hibernate.cfg.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mydatabase</property>
    <property name="hibernate.connection.username">myusername</property>
    <property name="hibernate.connection.password">mypassword</property>
    <property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>
    <mapping resource="com/nnews/table1.hbm.xml"/>
    <mapping resource="com/nnews/table2.hbm.xml"/>
   
  </session-factory>
</hibernate-configuration>


I have battled with this for the whole week and I need some bit of direction.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.