-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate configuration for IBM Informix 12.10 [Netbeans]
PostPosted: Fri Nov 28, 2014 11:53 pm 
Newbie

Joined: Fri Nov 28, 2014 11:39 pm
Posts: 3
Hello,

I have already created my database in Informix and I can successfully connect it through command line or any program (such as IBM Data Studio). I want to implement hibernate using Netbeans but after I configured it, it gives me some errors.

here is my persistance.xml file:
Code:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">
    <persistence-unit name="szpital04" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
            <property name="javax.persistence.jdbc.driver" value="com.informix.jdbc.IfxDriver"/>
            <property name="javax.persistence.jdbc.user" value="informix"/>
            <property name="javax.persistence.jdbc.password" value="parenrox123"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:informix-sqli://pari:9102/szpital04:INFORMIXSERVER=inz04;DELIMIDENT=y;"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.InformixDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
        </properties>
    </persistence-unit>
</persistence>
   

my project tree with libraries:
Image

my main class:
Code:
package info.paren.jpa;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class Main {
    public static void main(String[] args){
       
        EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("szpital04");
        EntityManager entityManager = entityManagerFactory.createEntityManager();
       
        entityManager.close();
        entityManagerFactory.close();
    }
}

and the output results:
Quote:
run:
lis 29, 2014 4:32:46 AM org.hibernate.ejb.HibernatePersistence logDeprecation
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
lis 29, 2014 4:32:46 AM org.hibernate.ejb.HibernatePersistence logDeprecation
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
lis 29, 2014 4:32:46 AM org.hibernate.ejb.HibernatePersistence logDeprecation
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
lis 29, 2014 4:32:46 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: szpital04
...]
lis 29, 2014 4:32:46 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.7.Final}
lis 29, 2014 4:32:46 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
lis 29, 2014 4:32:46 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
lis 29, 2014 4:32:46 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
lis 29, 2014 4:32:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)
lis 29, 2014 4:32:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000401: using driver [com.informix.jdbc.IfxDriver] at URL [jdbc:informix-sqli://pari:9102/szpital04:INFORMIXSERVER=inz04;DELIMIDENT=y;]
lis 29, 2014 4:32:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000046: Connection properties: {user=informix, password=****}
lis 29, 2014 4:32:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000006: Autocommit mode: false
lis 29, 2014 4:32:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Exception in thread "main" javax.persistence.PersistenceException: Unable to build entity manager factory
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:83) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:83)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
at info.paren.jpa.Main.main(Main.java:14)
Caused by: org.hibernate.exception.JDBCConnectionException: Unable to set auto-commit (false)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator$1$1.convert(BasicConnectionCreator.java:122)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:140)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:95)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:106)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
... 4 more
Caused by: java.sql.SQLException: Transactions not supported
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:408)
at com.informix.jdbc.IfxSqliConnect.setAutoCommit(IfxSqliConnect.java:2230)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:91)
... 20 more
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)


What am I doing wrong? I have already tried to change
Code:
<provider>org.hibernate.ejb.HibernatePersistence</provider>
to
Code:
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
in my persistance.xml file but it doesn't help. Please help me..


Top
 Profile  
 
 Post subject: Re: Hibernate configuration for IBM Informix 12.10 [Netbeans]
PostPosted: Sat Nov 29, 2014 9:06 pm 
Newbie

Joined: Fri Nov 28, 2014 11:39 pm
Posts: 3
Well,

Firstly I was thinking maybe it is problem of Netbeans so I tried with Eclipse which shows me the same errors..

Then I installed MySQL database and it works perfectly.. but I have to do this with IBM Informix.. still don't know how to handle it and where the problem is..


Top
 Profile  
 
 Post subject: Re: Hibernate configuration for IBM Informix 12.10 [Netbeans]
PostPosted: Tue Dec 09, 2014 2:44 am 
Newbie

Joined: Fri Nov 28, 2014 11:39 pm
Posts: 3
"Thanks" for help, after 10 days I've solved my problem by myself.

All I had to do was activating transaction logging during creating my database.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.