This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes Hibernate@ oracle Express Edition (XE) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate@ oracle Express Edition (XE)" Watch "Hibernate@ oracle Express Edition (XE)" New topic
Author

Hibernate@ oracle Express Edition (XE)

Gupta Saurabh
Greenhorn

Joined: Dec 22, 2006
Posts: 4
Hibernate Mapping file is :

<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc racle:thin:@localhost:1521:xe</property>
<property name="hibernate.connection.username">SAURABH-PRACTICE</property>
<property name="hibernate.connection.password">sys123</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="contact.hbm.xml"/>

I was trying to insert a simple data inside a table (Contact).

try {
SessionFactory sessionFactory = new Configuration().configure()
.buildSessionFactory();
session = sessionFactory.openSession();
System.out.println("Inserting Record");
Contact contact = new Contact();
contact.setId(6);
contact.setFirstName("Alice");
contact.setLastName("Wonderland");
contact.setEmail("Alice.Wonderland@yahoo.com");
session.save(contact);
System.out.println("Done");
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
} finally {
session.flush();
session.close();
}

<<<<< Problem: It is going smoothly, but it is not inserting any data in the table and also not throwing any exception for the same. >>>>>>

Is there any problem with the OracleDialect?
should i use something else?


~Regards<br />Saurabh Gupta
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

No, you just need to get and begin a Transaction, then commit it.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Gupta Saurabh
Greenhorn

Joined: Dec 22, 2006
Posts: 4
Thanks Mark.
I really appreciate that you have taken effort in answering the very simple question.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate@ oracle Express Edition (XE)