Hibernate + Oracle 10g XE

mavinatic

Bekanntes Mitglied
Hallo Winterschlafenden ;-)

Ich bin gerade dabei das erstemal mit Hibernate zu arbeiten als Datenbank habe ich eine Oracle 10g XE.

aber iwie bekomme ich eine Fehlermeldung vllt könnt ihr mir ja helfen?! Das problem ist ich bekomme keine Exception, es wird weder in die Table was geschrieben noch kann ich iwas auslesen, aber schaut mal über meinen Code bitte:

Java:
package roseindia.tutorial.hibernate;

/**
 * @author Deepak Kumar
 *
 * Java Class to map to the datbase Contact Table
 */
public class Contact {
  private String firstName;
  private String lastName;
  private String email;
  private long id;

  /**
   * @return Email
   */
  public String getEmail() {
    return email;
  }

  /**
   * @return First Name
   */
  public String getFirstName() {
    return firstName;
  }

  /** 
   * @return Last name
   */
  public String getLastName() {
    return lastName;
  }

  /**
   * @param string Sets the Email
   */
  public void setEmail(String string) {
    email = string;
  }

  /**
   * @param string Sets the First Name
   */
  public void setFirstName(String string) {
    firstName = string;
  }

  /**
   * @param string sets the Last Name
   */
  public void setLastName(String string) {
    lastName = string;
  }

  /**
   * @return ID Returns ID
   */
  public long getId() {
    return id;
  }

  /**
   * @param l Sets the ID
   */
  public void setId(long l) {
    id = l;
  }

}
Java:
package roseindia.tutorial.hibernate;

import java.util.List;

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


/**
 * @author Deepak Kumar
 *
 * [url=http://www.roseindia.net]JSP Tutorials,EJB Tutorial,JDBC Tutorials,Free Java Servlets Tutorials, WAP Tutorials, Spring Framework Tutorials, J2EE Tutorials, BioInformatics Tutorials, Java Server Faces Tutorials, Jboss Tutorials, Hibernate Tutorials, XML and MySQL Tutorials[/url]
 * Hibernate example to inset data into Contact table
 */
public class FirstExample {
  public static void main(String[] args) {
    Session session = null;

    try{
      // This step will read hibernate.cfg.xml 

//and prepare hibernate for use
      SessionFactory sessionFactory = new 

Configuration().configure().buildSessionFactory();
       session =sessionFactory.openSession();
        //Create new instance of Contact and set 

//values in it by reading them from form object
         System.err.println("Inserting Record");
        Contact contact = new Contact();
        contact.setId(3);
        contact.setFirstName("Deepak");
        contact.setLastName("Kumar");
        contact.setEmail("deepak_38@yahoo.com");
        session.save(contact);
        System.err.println("Done");
        
        List list = session.createSQLQuery("FROM CONTACT").list();
        
        for(int i=0;i<list.size();i++) {
            System.err.println(list.get(i));
        }
    }catch(Exception e){
      System.out.println(e.getMessage());
    }finally{
      // Actual contact insertion will happen at this step
      session.flush();
      session.close();

      }
    
  }
}

Java:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
  <class name="roseindia.tutorial.hibernate.Contact" table="CONTACT">
   <id name="id" type="long" column="ID" >
   <generator class="assigned"/>
  </id>

  <property name="firstName">
     <column name="FIRSTNAME" />
  </property>
  <property name="lastName">
    <column name="LASTNAME"/>
  </property>
  <property name="email">
    <column name="EMAIL"/>
  </property>
 </class>
</hibernate-mapping>

Java:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">user</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="connection.password">user</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="current_session_context_class">thread</property>
<property name="show_sql">true</property>
<!-- mapping files -->
<mapping resource="roseindia/tutorial/hibernate/contact.hbm.xml"/>
</session-factory>
</hibernate-configuration>

Wie unschwer zu erkennen ist ist es von einem Tutorial, aber ich möchts zum laufen bekommen? und über google find ich nichts :(

Gruß George
 
G

gman

Gast
Hi,

stimmt den dein Pfad zur Mapping-Datei? Also der:

Code:
<mapping resource="roseindia/tutorial/hibernate/contact.hbm.xml"/>
 

mavinatic

Bekanntes Mitglied
Ja ist sie, hier die Consolenausgabe
Java:
00:30:12,671  INFO Environment:543 - Hibernate 3.3.1.GA
00:30:12,687  INFO Environment:576 - hibernate.properties not found
00:30:12,687  INFO Environment:709 - Bytecode provider name : javassist
00:30:12,687  INFO Environment:627 - using JDK 1.4 java.sql.Timestamp handling
00:30:12,750  INFO Configuration:1460 - configuring from resource: /hibernate.cfg.xml
00:30:12,750  INFO Configuration:1437 - Configuration resource: /hibernate.cfg.xml
00:30:12,828 DEBUG DTDEntityResolver:64 - trying to resolve system-id [[url]http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd][/url]
00:30:12,828 DEBUG DTDEntityResolver:66 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
00:30:12,828 DEBUG DTDEntityResolver:70 - unable to locate [[url]http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd][/url] on classpath
00:30:12,828 ERROR DTDEntityResolver:72 - Don't use old DTDs, read the Hibernate 3.x Migration Guide!
00:30:14,203 DEBUG Configuration:1421 - connection.username=user
00:30:14,203 DEBUG Configuration:1421 - connection.url=jdbc:oracle:thin:@localhost:1521:xe
00:30:14,203 DEBUG Configuration:1421 - dialect=org.hibernate.dialect.Oracle10gDialect
00:30:14,203 DEBUG Configuration:1421 - connection.password=user
00:30:14,203 DEBUG Configuration:1421 - connection.driver_class=oracle.jdbc.driver.OracleDriver
00:30:14,218 DEBUG Configuration:1421 - current_session_context_class=thread
00:30:14,218 DEBUG Configuration:1421 - show_sql=true
00:30:14,218 DEBUG Configuration:1620 - null<-org.dom4j.tree.DefaultAttribute@e5855a [Attribute: name resource value "roseindia/tutorial/hibernate/contact.hbm.xml"]
00:30:14,218  INFO Configuration:586 - Reading mappings from resource : roseindia/tutorial/hibernate/contact.hbm.xml
00:30:14,218 DEBUG DTDEntityResolver:64 - trying to resolve system-id [[url]http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd][/url]
00:30:14,218 DEBUG DTDEntityResolver:66 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
00:30:14,218 DEBUG DTDEntityResolver:76 - located [[url]http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd][/url] in classpath
00:30:14,328  INFO HbmBinder:322 - Mapping class: roseindia.tutorial.hibernate.Contact -> CONTACT
00:30:14,328 DEBUG HbmBinder:1289 - Mapped property: id -> ID
00:30:14,343 DEBUG HbmBinder:1289 - Mapped property: firstName -> FIRSTNAME
00:30:14,343 DEBUG HbmBinder:1289 - Mapped property: lastName -> LASTNAME
00:30:14,343 DEBUG HbmBinder:1289 - Mapped property: email -> EMAIL
00:30:14,343  INFO Configuration:1575 - Configured SessionFactory: null
00:30:14,343 DEBUG Configuration:1576 - properties: {hibernate.connection.password=user, java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=C:\Programme\Java\jre6\bin, java.vm.version=17.0-b17, hibernate.connection.username=user, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=DE, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=Service Pack 3, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\workspace\hibernatetutorial, java.runtime.version=1.6.0_21-b07, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, hibernate.current_session_context_class=thread, java.endorsed.dirs=C:\Programme\Java\jre6\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOKUME~1\george\LOKALE~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, sun.jnu.encoding=Cp1252, java.library.path=C:\Programme\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Programme/Java/jre6/bin/client;C:/Programme/Java/jre6/bin;C:/Programme/Java/jre6/lib/i386;D:\oraclexe\app\oracle\product\10.2.0\server\bin;c:\Programme\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\QuickTime\QTSystem\;D:\IsoBuster;C:\Programme\Gemeinsame Dateien\Adobe\AGL;C:\Programme\Java\jdk1.6.0_20\bin;D:\Liquid XML Studio 2009\XmlDataBinder7\Redist7\cpp\win32\bin, java.specification.name=Java Platform API Specification, java.class.version=50.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.1, connection.password=user, user.home=C:\Dokumente und Einstellungen\george, user.timezone=Europe/Berlin, connection.username=user, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.6, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, show_sql=true, user.name=george, java.class.path=D:\workspace\hibernatetutorial\bin;D:\workspace\hibernatetutorial\libs\antlr-2.7.6.jar;D:\workspace\hibernatetutorial\libs\backport-util-concurrent.jar;D:\workspace\hibernatetutorial\libs\commons-collections-3.1.jar;D:\workspace\hibernatetutorial\libs\commons-logging-1.1.1.jar;D:\workspace\hibernatetutorial\libs\dom4j-1.6.1.jar;D:\workspace\hibernatetutorial\libs\ehcache-1.5.0.jar;D:\workspace\hibernatetutorial\libs\ejb3-persistence.jar;D:\workspace\hibernatetutorial\libs\hibernate-annotations.jar;D:\workspace\hibernatetutorial\libs\hibernate-commons-annotations.jar;D:\workspace\hibernatetutorial\libs\hibernate-core.jar;D:\workspace\hibernatetutorial\libs\hibernate-search.jar;D:\workspace\hibernatetutorial\libs\javassist-3.9.0.GA.jar;D:\workspace\hibernatetutorial\libs\jta-1.1.jar;D:\workspace\hibernatetutorial\libs\log4j-1.2.14.jar;D:\workspace\hibernatetutorial\libs\lucene-core.jar;D:\workspace\hibernatetutorial\libs\ojdbc14.jar;D:\workspace\hibernatetutorial\libs\slf4j-api-1.5.8.jar;D:\workspace\hibernatetutorial\libs\slf4j-log4j12.jar;D:\workspace\hibernatetutorial\libs\xml-apis.jar, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=true, current_session_context_class=thread, java.vm.specification.version=1.0, java.home=C:\Programme\Java\jre6, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.Oracle10gDialect, hibernate.connection.url=jdbc:oracle:thin:@localhost:1521:xe, user.language=de, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, sharing, java.version=1.6.0_21, java.ext.dirs=C:\Programme\Java\jre6\lib\ext;C:\WINDOWS\Sun\Java\lib\ext, sun.boot.class.path=C:\Programme\Java\jre6\lib\resources.jar;C:\Programme\Java\jre6\lib\rt.jar;C:\Programme\Java\jre6\lib\sunrsasign.jar;C:\Programme\Java\jre6\lib\jsse.jar;C:\Programme\Java\jre6\lib\jce.jar;C:\Programme\Java\jre6\lib\charsets.jar;C:\Programme\Java\jre6\classes, java.vendor=Sun Microsystems Inc., connection.driver_class=oracle.jdbc.driver.OracleDriver, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, connection.url=jdbc:oracle:thin:@localhost:1521:xe, dialect=org.hibernate.dialect.Oracle10gDialect, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86}
00:30:14,343 DEBUG Configuration:1318 - Preparing to build session factory with filters : {}
00:30:14,343 DEBUG Configuration:1153 - processing extends queue
00:30:14,359 DEBUG Configuration:1157 - processing collection mappings
00:30:14,359 DEBUG Configuration:1168 - processing native query and ResultSetMapping mappings
00:30:14,359 DEBUG Configuration:1176 - processing association property references
00:30:14,359 DEBUG Configuration:1198 - processing foreign key constraints
00:30:14,421  INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
00:30:14,421  INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 20
00:30:14,421  INFO DriverManagerConnectionProvider:68 - autocommit mode: false
00:30:14,421  INFO DriverManagerConnectionProvider:103 - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@localhost:1521:xe
00:30:14,421  INFO DriverManagerConnectionProvider:106 - connection properties: {user=user, password=user}
00:30:14,421 DEBUG DriverManagerConnectionProvider:132 - opening new JDBC connection
00:30:14,640 DEBUG DriverManagerConnectionProvider:138 - created connection to: jdbc:oracle:thin:@localhost:1521:xe, Isolation Level: 2
00:30:14,640  INFO SettingsFactory:116 - RDBMS: Oracle, version: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
00:30:14,640  INFO SettingsFactory:117 - JDBC driver: Oracle JDBC driver, version: 10.2.0.1.0
00:30:14,656  INFO Dialect:175 - Using dialect: org.hibernate.dialect.Oracle10gDialect
00:30:14,671  INFO TransactionFactoryFactory:59 - Using default transaction strategy (direct JDBC transactions)
00:30:14,671  INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
00:30:14,671  INFO SettingsFactory:170 - Automatic flush during beforeCompletion(): disabled
00:30:14,671  INFO SettingsFactory:174 - Automatic session close at end of transaction: disabled
00:30:14,671  INFO SettingsFactory:181 - JDBC batch size: 15
00:30:14,671  INFO SettingsFactory:184 - JDBC batch updates for versioned data: disabled
00:30:14,671  INFO SettingsFactory:189 - Scrollable result sets: enabled
00:30:14,671 DEBUG SettingsFactory:193 - Wrap result sets: disabled
00:30:14,671  INFO SettingsFactory:197 - JDBC3 getGeneratedKeys(): disabled
00:30:14,671  INFO SettingsFactory:205 - Connection release mode: auto
00:30:14,671  INFO SettingsFactory:232 - Default batch fetch size: 1
00:30:14,671  INFO SettingsFactory:236 - Generate SQL with comments: disabled
00:30:14,671  INFO SettingsFactory:240 - Order SQL updates by primary key: disabled
00:30:14,671  INFO SettingsFactory:244 - Order SQL inserts for batching: disabled
00:30:14,671  INFO SettingsFactory:420 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
00:30:14,671  INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory
00:30:14,671  INFO SettingsFactory:252 - Query language substitutions: {}
00:30:14,671  INFO SettingsFactory:257 - JPA-QL strict compliance: disabled
00:30:14,671  INFO SettingsFactory:262 - Second-level cache: enabled
00:30:14,671  INFO SettingsFactory:266 - Query cache: disabled
00:30:14,671  INFO SettingsFactory:405 - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
00:30:14,671  INFO SettingsFactory:276 - Optimize cache for minimal puts: disabled
00:30:14,671  INFO SettingsFactory:285 - Structured second-level cache entries: disabled
00:30:14,671  INFO SettingsFactory:305 - Echoing all SQL to stdout
00:30:14,671  INFO SettingsFactory:314 - Statistics: disabled
00:30:14,671  INFO SettingsFactory:318 - Deleted entity synthetic identifier rollback: disabled
00:30:14,671  INFO SettingsFactory:333 - Default entity-mode: pojo
00:30:14,671  INFO SettingsFactory:337 - Named query checking : enabled
00:30:14,718  INFO SessionFactoryImpl:187 - building session factory
00:30:14,718 DEBUG SessionFactoryImpl:205 - Session factory constructed with filter configurations : {}
00:30:14,718 DEBUG SessionFactoryImpl:209 - instantiating session factory with properties: {java.runtime.name=Java(TM) SE Runtime Environment, hibernate.connection.password=user, sun.boot.library.path=C:\Programme\Java\jre6\bin, java.vm.version=17.0-b17, hibernate.connection.username=user, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=DE, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=Service Pack 3, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\workspace\hibernatetutorial, java.runtime.version=1.6.0_21-b07, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, hibernate.current_session_context_class=thread, java.endorsed.dirs=C:\Programme\Java\jre6\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOKUME~1\george\LOKALE~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, sun.jnu.encoding=Cp1252, java.library.path=C:\Programme\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Programme/Java/jre6/bin/client;C:/Programme/Java/jre6/bin;C:/Programme/Java/jre6/lib/i386;D:\oraclexe\app\oracle\product\10.2.0\server\bin;c:\Programme\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\QuickTime\QTSystem\;D:\IsoBuster;C:\Programme\Gemeinsame Dateien\Adobe\AGL;C:\Programme\Java\jdk1.6.0_20\bin;D:\Liquid XML Studio 2009\XmlDataBinder7\Redist7\cpp\win32\bin, java.specification.name=Java Platform API Specification, java.class.version=50.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.1, user.home=C:\Dokumente und Einstellungen\george, connection.password=user, user.timezone=Europe/Berlin, java.awt.printerjob=sun.awt.windows.WPrinterJob, connection.username=user, java.specification.version=1.6, file.encoding=Cp1252, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, show_sql=true, java.class.path=D:\workspace\hibernatetutorial\bin;D:\workspace\hibernatetutorial\libs\antlr-2.7.6.jar;D:\workspace\hibernatetutorial\libs\backport-util-concurrent.jar;D:\workspace\hibernatetutorial\libs\commons-collections-3.1.jar;D:\workspace\hibernatetutorial\libs\commons-logging-1.1.1.jar;D:\workspace\hibernatetutorial\libs\dom4j-1.6.1.jar;D:\workspace\hibernatetutorial\libs\ehcache-1.5.0.jar;D:\workspace\hibernatetutorial\libs\ejb3-persistence.jar;D:\workspace\hibernatetutorial\libs\hibernate-annotations.jar;D:\workspace\hibernatetutorial\libs\hibernate-commons-annotations.jar;D:\workspace\hibernatetutorial\libs\hibernate-core.jar;D:\workspace\hibernatetutorial\libs\hibernate-search.jar;D:\workspace\hibernatetutorial\libs\javassist-3.9.0.GA.jar;D:\workspace\hibernatetutorial\libs\jta-1.1.jar;D:\workspace\hibernatetutorial\libs\log4j-1.2.14.jar;D:\workspace\hibernatetutorial\libs\lucene-core.jar;D:\workspace\hibernatetutorial\libs\ojdbc14.jar;D:\workspace\hibernatetutorial\libs\slf4j-api-1.5.8.jar;D:\workspace\hibernatetutorial\libs\slf4j-log4j12.jar;D:\workspace\hibernatetutorial\libs\xml-apis.jar, user.name=george, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=true, current_session_context_class=thread, java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=C:\Programme\Java\jre6, hibernate.connection.url=jdbc:oracle:thin:@localhost:1521:xe, hibernate.dialect=org.hibernate.dialect.Oracle10gDialect, java.specification.vendor=Sun Microsystems Inc., user.language=de, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, sharing, java.version=1.6.0_21, java.ext.dirs=C:\Programme\Java\jre6\lib\ext;C:\WINDOWS\Sun\Java\lib\ext, sun.boot.class.path=C:\Programme\Java\jre6\lib\resources.jar;C:\Programme\Java\jre6\lib\rt.jar;C:\Programme\Java\jre6\lib\sunrsasign.jar;C:\Programme\Java\jre6\lib\jsse.jar;C:\Programme\Java\jre6\lib\jce.jar;C:\Programme\Java\jre6\lib\charsets.jar;C:\Programme\Java\jre6\classes, java.vendor=Sun Microsystems Inc., file.separator=\, connection.driver_class=oracle.jdbc.driver.OracleDriver, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, sun.desktop=windows, connection.url=jdbc:oracle:thin:@localhost:1521:xe, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86, dialect=org.hibernate.dialect.Oracle10gDialect}
00:30:14,890 DEBUG AbstractEntityPersister:2766 - Static SQL for entity: roseindia.tutorial.hibernate.Contact
00:30:14,890 DEBUG AbstractEntityPersister:2771 -  Version select: select ID from CONTACT where ID =?
00:30:14,890 DEBUG AbstractEntityPersister:2774 -  Snapshot select: select contact_.ID, contact_.FIRSTNAME as FIRSTNAME0_, contact_.LASTNAME as LASTNAME0_, contact_.EMAIL as EMAIL0_ from CONTACT contact_ where contact_.ID=?
00:30:14,890 DEBUG AbstractEntityPersister:2777 -  Insert 0: insert into CONTACT (FIRSTNAME, LASTNAME, EMAIL, ID) values (?, ?, ?, ?)
00:30:14,890 DEBUG AbstractEntityPersister:2778 -  Update 0: update CONTACT set FIRSTNAME=?, LASTNAME=?, EMAIL=? where ID=?
00:30:14,890 DEBUG AbstractEntityPersister:2779 -  Delete 0: delete from CONTACT where ID=?
00:30:14,921 DEBUG EntityLoader:102 - Static select for entity roseindia.tutorial.hibernate.Contact: select contact0_.ID as ID0_0_, contact0_.FIRSTNAME as FIRSTNAME0_0_, contact0_.LASTNAME as LASTNAME0_0_, contact0_.EMAIL as EMAIL0_0_ from CONTACT contact0_ where contact0_.ID=?
00:30:14,921 DEBUG EntityLoader:102 - Static select for entity roseindia.tutorial.hibernate.Contact: select contact0_.ID as ID0_0_, contact0_.FIRSTNAME as FIRSTNAME0_0_, contact0_.LASTNAME as LASTNAME0_0_, contact0_.EMAIL as EMAIL0_0_ from CONTACT contact0_ where contact0_.ID=?
00:30:14,921 DEBUG EntityLoader:102 - Static select for entity roseindia.tutorial.hibernate.Contact: select contact0_.ID as ID0_0_, contact0_.FIRSTNAME as FIRSTNAME0_0_, contact0_.LASTNAME as LASTNAME0_0_, contact0_.EMAIL as EMAIL0_0_ from CONTACT contact0_ where contact0_.ID=? for update
00:30:14,921 DEBUG EntityLoader:102 - Static select for entity roseindia.tutorial.hibernate.Contact: select contact0_.ID as ID0_0_, contact0_.FIRSTNAME as FIRSTNAME0_0_, contact0_.LASTNAME as LASTNAME0_0_, contact0_.EMAIL as EMAIL0_0_ from CONTACT contact0_ where contact0_.ID=? for update nowait
00:30:14,921 DEBUG EntityLoader:102 - Static select for entity roseindia.tutorial.hibernate.Contact: select contact0_.ID as ID0_0_, contact0_.FIRSTNAME as FIRSTNAME0_0_, contact0_.LASTNAME as LASTNAME0_0_, contact0_.EMAIL as EMAIL0_0_ from CONTACT contact0_ where contact0_.ID=? for update nowait
00:30:14,921 DEBUG EntityLoader:57 - Static select for action ACTION_MERGE on entity roseindia.tutorial.hibernate.Contact: select contact0_.ID as ID0_0_, contact0_.FIRSTNAME as FIRSTNAME0_0_, contact0_.LASTNAME as LASTNAME0_0_, contact0_.EMAIL as EMAIL0_0_ from CONTACT contact0_ where contact0_.ID=?
00:30:14,921 DEBUG EntityLoader:57 - Static select for action ACTION_REFRESH on entity roseindia.tutorial.hibernate.Contact: select contact0_.ID as ID0_0_, contact0_.FIRSTNAME as FIRSTNAME0_0_, contact0_.LASTNAME as LASTNAME0_0_, contact0_.EMAIL as EMAIL0_0_ from CONTACT contact0_ where contact0_.ID=?
00:30:14,937 DEBUG SessionFactoryObjectFactory:62 - initializing class SessionFactoryObjectFactory
00:30:14,937 DEBUG SessionFactoryObjectFactory:99 - registered: 402881832b26f817012b26f818890000 (unnamed)
00:30:14,937  INFO SessionFactoryObjectFactory:105 - Not binding factory to JNDI, no JNDI name configured
00:30:14,937 DEBUG SessionFactoryImpl:340 - instantiated session factory
00:30:14,937 DEBUG SessionFactoryImpl:426 - Checking 0 named HQL queries
00:30:14,937 DEBUG SessionFactoryImpl:446 - Checking 0 named SQL queries
00:30:14,968 DEBUG SessionImpl:247 - opened session at timestamp: 12848490149
Inserting Record
00:30:14,984 DEBUG AbstractSaveEventListener:135 - generated identifier: 3, using strategy: org.hibernate.id.Assigned
Done
00:30:15,015 DEBUG AbstractBatcher:410 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
00:30:15,015 DEBUG ConnectionManager:444 - opening JDBC connection
00:30:15,015 DEBUG SQL:111 - FROM CONTACT
Hibernate: FROM CONTACT
00:30:15,140 DEBUG AbstractBatcher:418 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
00:30:15,140 DEBUG JDBCExceptionReporter:92 - could not execute query [FROM CONTACT]
java.sql.SQLException: ORA-00900: Ungültige SQL-Anweisung

    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
    at org.hibernate.loader.Loader.doQuery(Loader.java:697)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    at org.hibernate.loader.Loader.doList(Loader.java:2228)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
    at org.hibernate.loader.Loader.list(Loader.java:2120)
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
    at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722)
    at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
    at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
    at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:40)
00:30:15,156  WARN JDBCExceptionReporter:100 - SQL Error: 900, SQLState: 42000
00:30:15,156 ERROR JDBCExceptionReporter:101 - ORA-00900: Ungültige SQL-Anweisung

00:30:15,156 DEBUG ConnectionManager:427 - aggressively releasing JDBC connection
00:30:15,156 DEBUG ConnectionManager:464 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
could not execute query
00:30:15,156 DEBUG AbstractFlushingEventListener:134 - processing flush-time cascades
00:30:15,156 DEBUG AbstractFlushingEventListener:177 - dirty checking collections
00:30:15,156 DEBUG AbstractFlushingEventListener:108 - Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
00:30:15,156 DEBUG AbstractFlushingEventListener:114 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
00:30:15,156 DEBUG Printer:106 - listing entities:
00:30:15,156 DEBUG Printer:113 - roseindia.tutorial.hibernate.Contact{id=3, lastName=Kumar, email=deepak_38@yahoo.com, firstName=Deepak}
00:30:15,156 DEBUG AbstractBatcher:410 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
00:30:15,156 DEBUG ConnectionManager:444 - opening JDBC connection
00:30:15,156 DEBUG SQL:111 - insert into CONTACT (FIRSTNAME, LASTNAME, EMAIL, ID) values (?, ?, ?, ?)
Hibernate: insert into CONTACT (FIRSTNAME, LASTNAME, EMAIL, ID) values (?, ?, ?, ?)
00:30:15,156 DEBUG AbstractBatcher:66 - Executing batch size: 1
00:30:15,156 DEBUG Expectations:77 - success of batch update unknown: 0
00:30:15,156 DEBUG AbstractBatcher:418 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
00:30:15,156 DEBUG ConnectionManager:464 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
00:30:15,156 DEBUG ConnectionManager:427 - aggressively releasing JDBC connection
 

mavinatic

Bekanntes Mitglied
Habe den Fehler gefunden!

man brauch auch noch ein Transactionsobjekt

Transaction tx = session.beginTransaction();

...

tx.commit();
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
I Hibernate / JPA: Eine Datenbank und pro User ein Schema Data Tier 9
T Hibernate/Spring JPA: eigene ID generieren Data Tier 5
Avalon @ManyToOne Hibernate oder JPA? Data Tier 5
D Hibernate Hibernate mit MariaDB Data Tier 1
ToBJo Hibernate Glassfish deploy mit Hibernate schlägt fehl Data Tier 1
C JPA Hibernate Map<String,String> richtig mappen Data Tier 2
S JPA Hibernate Search & EclipseLink (oder OpenJPA) Data Tier 0
R JPA Probleme mit Wechsel von EclipseLink auf Hibernate Data Tier 4
ARadauer Hibernate Entität readonly laden... Data Tier 1
G Hibernate SQL in Hibernate: Keine Parameter mit Index? Data Tier 2
P Wildfly + Hibernate + SQL Server Data Tier 0
E JPA Hibernate Query mit Timestamp hat seltsames Verhalten Data Tier 1
M Eclipse 4 RCP Hibernate Problem Data Tier 3
C Hibernate ProgressBar updaten mit Daten aus Hibernate Data Tier 4
B Hibernate und MySQL testen Data Tier 8
I Hibernate HQL: generiertes SQL ausgeben Data Tier 1
R mapping-file für hibernate zum Überschreiben der Annotationen Data Tier 7
R Hibernate Hibernate und Logback Data Tier 2
R Hibernate möchte Schema zwei mal undeployen Data Tier 2
F Hibernate Hibernate / JPA Data Tier 4
E Hibernate: Session vs EntityManager Data Tier 3
C Hibernate Hibernate Code Generation Data Tier 3
S Hibernate Mehrfachverbindung mit Hibernate Data Tier 3
M Hibernate Einstiegsfrage Data Tier 5
M Exception in thread "main" org.hibernate.MappingException: java.lang.ClassNotFoundException: Message Data Tier 4
S Hibernate Einstieg in Hibernate 3.2 sinnvoll? Data Tier 8
P JPA Eigene Vererbungsstrategie mit JPA / Hibernate Data Tier 2
J Hibernate Problem bei Master-Detail-Tabellen Data Tier 5
Y Jboss seam-hibernate-jpa Data Tier 5
RaoulDuke Hibernate Map<String,String> mit Annotations mappen Data Tier 2
M Hibernate Hibernate with GWT Data Tier 4
C Hibernate JPA mysql db erstellen Data Tier 4
M Hibernate Hibernate liest Daten zu oft aus! Data Tier 16
pg1337 Hibernate Fragen Data Tier 11
D Probleme bei Left Joins mit Hibernate createCriterias() Data Tier 2
D Hibernate probleme mit Verlinkungstabelle Data Tier 4
2 Hibernate Annotations Data Tier 7
G Hibernate select update no wait Data Tier 8
Z Hibernate: Many-To-Many nur eine bestimmte Spalte Data Tier 3
K Hibernate - Envers - Erzeugung der SQL Skripte Data Tier 4
G Hibernate 1:n Beziehung mit Vererbung Data Tier 5
D Hibernate-Criteria-API (Projections und MAX-Funktion) Data Tier 6
L Hibernate: failed to lazily initialize a collection of role Data Tier 3
S Hibernate hibernate.cfg.xml Data Tier 14
D JPA vs Hibernate.cfg und Entitymanager Data Tier 6
H Hibernate - Mapping für Enumeration Data Tier 1
R Hibernate Criteria Abfrageproblem Data Tier 2
A Hibernate und jdbc zusammen Data Tier 4
D Mit Hibernate aus JUnit ein DB-Schema erzeugen Data Tier 6
S [Hibernate] No Persistence provider for EntityManager Data Tier 5
B Problem mit org.hibernate.LazyInitializationException Data Tier 11
G Hibernate HQL und Interface Data Tier 4
G JSF Hibernate no session or session was closed Data Tier 12
T JPA2/Hibernate: Many-to-Many-Relation wird u.a. beim löschen nicht aktualisiert Data Tier 14
S (Hibernate) Mapping einer Datenbanktabelle mit mehreren Fremdschlüssel Data Tier 7
X [Hibernate] Zusammengesetzte Entities möglich? Data Tier 7
N Hibernate Fake? Data Tier 2
S Problem beim Insert mit Hibernate Data Tier 9
V Hibernate Projection Data Tier 2
T org.hibernate.impl.SessionFactoryImpl Memory Leak Data Tier 10
G Hibernate Composite key Data Tier 11
X [Hibernate] Connection Pool - MinSize ? Data Tier 2
R Hibernate Criteria OR Data Tier 2
T hibernate/jpa abgefragte Listen immer mit Null-Werten gefüllt Data Tier 8
X [Hibernate] Anderen Connection Pool - Vorschläge? Data Tier 3
ARadauer Hibernate DDL Loggen Data Tier 6
G Hibernate abfrage Collection Data Tier 3
X [Hibernate] ReverseEngineering - Eigene Strategy verwenden? Data Tier 3
R Hibernate Criteria .group größer als Data Tier 5
R Hibernate daten laden Data Tier 7
H [Hibernate]1:1 Beziehung Data Tier 8
H [Hibernate]No CurrentSessionContext configured! Data Tier 6
X [Hibernate] Lässt sich die Dauer eines SELECTs loggen? Data Tier 4
R Hibernate n:n Relationtabelle mit Date Data Tier 3
H [Hibernate] Unknown Entity Data Tier 3
H [Hibernate] Configuration Data Tier 3
C [Hibernate] Generierung von hbm.xml to Java Data Tier 4
lumo Eclipse & JPA & Hibernate & Derby Data Tier 5
J Zufallsauswahl aus ResultList bei JPA(Hibernate) / Performance Data Tier 3
M Hibernate: Datum 0001-01-01 erzeugt null-Datum Data Tier 4
G Datenbankzugriff mit Hibernate Data Tier 7
Y Hibernate - Angabe des Schemas Data Tier 6
LadyMilka (Hibernate) in Criteria implizierter Join durch Subquery's Data Tier 8
M Hibernate Mehr als 1 Object speichern? Data Tier 18
M Unerklärliche Hibernate Exception Data Tier 20
LadyMilka (Hibernate) subquery in FROM-Clause Data Tier 9
haemi Viele DTOs in hibernate IdentityMap Data Tier 3
LadyMilka (hibernate) UNION dem Dialekt hinzufügen Data Tier 3
lumo Hibernate - entity class not found Data Tier 5
P SQL PRoblem Hibernate? Data Tier 8
J Vererbung mit JPA / Hibernate - pro/contra Data Tier 3
T JBoss/Hibernate: Abfrage dauert lang + hohe CPU? Data Tier 19
7 Hibernate-Abfrage (SubSelect im FROM) Data Tier 2
G Hibernate: many-to-one - Verwaiste Datensätze löschen Data Tier 2
G Layer für Datenbankzugriff Hibernate Data Tier 5
G Hibernate Zwischentabelle Data Tier 2
Java.getSkill() Hibernate und Spalte vom Typ xml Data Tier 6
G Hibernate 0...1 : 1 Beziehung Data Tier 6
G Hibernate mehrere @oneToone Data Tier 2
G Hibernate 1:n, 1:1 Data Tier 26

Ähnliche Java Themen


Oben