-->
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.  [ 2 posts ] 
Author Message
 Post subject: Begin transaction erzeugt unverständlichen Fehler
PostPosted: Sat Nov 17, 2007 7:29 pm 
Newbie

Joined: Sat Nov 17, 2007 7:17 pm
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
322

<!DOCTYPE hibernate-configuration PUBLIC '-//Hibernate/Hibernate Configuration DTD 3.0//EN' 'http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd'>
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.firebirdsql.jdbc.FBDriver</property>
<property name="connection.connection.url">jdbc:firebirdsql:localhost/3050:D:/Files/dycept/Extern/SW_Dlite/Code/PracticeDB/TEST_Hibernate.fdb</property>
<property name="connection.username">SYSDBA</property>
<property name="connection.password">berlin</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.FirebirdDialect</property>

<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">false</property>

<!-- Drop and re-create the database schema on startup -->
<!--- <property name="hbm2ddl.auto">create</property> -->

<mapping resource="POJOs/Friend.hbm.xml"/>

</session-factory>

</hibernate-configuration>

Mapping documents:


<!DOCTYPE hibernate-mapping PUBLIC '-//Hibernate/Hibernate Mapping DTD 3.0//EN' 'http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd'>
<hibernate-mapping>
<class name="POJOs.Friend" table="PERSONEN">
<id name="id" column="PERSONEN_ID">
<generator class="native"></generator>
</id>
<property name="Vorname" column="VORNAME"></property>
<property name="Nachname" column="NACHNAME"></property>
<property name="Alter" column="ALTER"></property>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

public static void main(String[] args) {

Session mySess = HibernateUtil.getSessionFactory().getCurrentSession();

mySess.beginTransaction();

mySess.getTransaction().commit();
}

Full stack trace of any exception that occurs:

Exception in thread "main" java.lang.UnsupportedOperationException: The user must supply a JDBC connection
at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:30)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
at $Proxy0.beginTransaction(Unknown Source)
at hibertest.Main.main(Main.java:34)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)


Name and version of the database you are using:
firebird with jaybird 2.0.1


Debug level Hibernate log excerpt:
what the ...?


The Error above drives me crazy I can´t find solutions on the web so i guess i am missing out on something, that is so easy, that i can´t see it.

The error shown above accurs in the line:

mySess.beginTransaction();


Need help

Bitte

Haspost

_________________
looking for userfriendly stuff... all my life


Top
 Profile  
 
 Post subject: Re: Begin transaction erzeugt unverständlichen Fehler
PostPosted: Tue Nov 20, 2007 7:32 am 
Beginner
Beginner

Joined: Thu Jan 04, 2007 5:44 am
Posts: 26
Location: Innsbruck - Sivas(TR) - Bregenz
Hi try this..

Code:
public static void main(String[] args) {
SessionFactory sessionFactory;
//configfile stored in src folder..
String configFile="/hibernate.cfg.xml";
Configuration configuration = new Configuration();
configuration.configure(configFile);
sessionFactory = configuration.buildSessionFactory();
Session s= sessionFactory.openSession()
Transaction tx = s.beginTransaction();
//hibernate action...
tx.commit;
}


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

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.