Einzelnen Beitrag anzeigen

BörmtDieBuse

Registriert seit: 25. Mär 2015
26 Beiträge
 
#5

AW: Hibernate und DAO und Reports

  Alt 7. Mai 2015, 07:24
Ich hab bei Stackoverflow nach meinem Problem gesucht und auch etwas gefunden aber leider hab ich jetzt ein anderes Problem
wo ich keine Lösung finde. Aus Sicherheitsgründen habe ich die "hibernate.connection.url" allgemein gehaten

Besonders das verwundet mich, "INFO: HHH000206: hibernate.properties not found"
versteh ich nicht warum er sie nicht finden sollte. Mein classpath hab ich nicht verändert und mein hibernate.cfg.xml file liegt in "src"

Ich hoffe einer kann mir weierhelfen, versuch das ganze schon seit gestern vormittag zu lösen.
Vielen Dank!

Code:
package hibernate;
 import java.util.Date;

 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.cfg.Configuration;

 import persistencelayer.*;

 public class HibernateTest {

 public static void main(String[] args) {

    TestUserDetails user2 = new TestUserDetails();
    user2.setUserId(1);
    user2.setUserName("First User");
    user2.setAddress("First User's address");
    user2.setJoinedDate(new Date());
    user2.setDescription("Description of the user goes here");

    try {
    //SessionFactory wird erzeugt, mit der Konfiguration von Hibernate
    SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
    Session session = sessionFactory.openSession();
    session.beginTransaction();

 //     session.save(user);

    session.save(user2);
    session.getTransaction().commit();
    } catch (Exception e) {
        System.out.println("Fehler beim erstellen der SessionFactory");
    }



}

}

Hibernate.cfg.xml Konfiguration
Code:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>
    <!-- Database connection settings -->
    <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
    <property name="hibernate.connection.url">jdbc:oracle:thin:@host:port:ssid:</property>
    <property name="hibernate.connection.username">name</property>
    <property name="hibernate.connection.password">password</property>

    <!-- JDBC connection pool (use the built-in) -->
    <property name="hibernate.connection.pool_size">1</property>

    <!-- SQL dialect -->
    <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>

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

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

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

    <!-- Names the annotated entity class -->
    <mapping class="persistencelayer.Project"/>
    <mapping class="persistencelayer.User"/>
    <!-- <mapping class="persistencelayer.Employer"/>
    <mapping class="persistencelayer.IndividualTest"/>
    <mapping class="persistencelayer.ObjectType"/>
    <mapping class="persistencelayer.TestChamber"/>
    <mapping class="persistencelayer.TestMethod"/>
    <mapping class="persistencelayer.TestUserDetails"/> -->


</session-factory>
Fehlermeldungen
Code:
Mai 07, 2015 7:50:32 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
Mai 07, 2015 7:50:32 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.9.Final}
Mai 07, 2015 7:50:32 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Mai 07, 2015 7:50:33 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Mai 07, 2015 7:50:33 AM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
Mai 07, 2015 7:50:33 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
Mai 07, 2015 7:50:33 AM org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
Mai 07, 2015 7:50:33 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Mai 07, 2015 7:50:33 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@host:port:ssid:]
Mai 07, 2015 7:50:33 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000046: Connection properties: {user=qqrhldb, password=****}
Mai 07, 2015 7:50:33 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000006: Autocommit mode: false
Mai 07, 2015 7:50:33 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 1 (min=1)
Fehler beim erstellen der SessionFactory
  Mit Zitat antworten Zitat