• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot insert into db with hibernate HELPPP :(  RSS feed

Adriana Lazar
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, i am using oracle 10 g and i am trying to insert into table Comments a new comment, but it doesn't insert anything!
Please help I really need to solve this problem

This is what I get:

03:46:24,765 DEBUG SQL:401 - select max(id) from comments
Hibernate: select max(id) from comments
03:46:24,906 DEBUG SQL:401 - insert into comments (objectiveId, comments, id) values (?, ?, ?)
Hibernate: insert into comments (objectiveId, comments, id) values (?, ?, ?)

and THAT'S IT...no errors no nothing it just stops.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<class name="home.db.Comments" table="comments">
<id name="id" column="id" type="java.lang.Integer">
<generator class="increment"/>
<property name ="objectiveId" column="objectiveId" type="java.lang.Integer"/>
<property name="comments" column="comments" type="java.lang.String" />

code called:

main {
DbManager dm = new DbManager();
dm.addComment("1", "aaaaaaaaa");

public void addComment(String id, String comment) {
Transaction tx = null;
Session session = null;
Comments comments = new Comments();
try {
session = InitSessionFactory.getInstance().getCurrentSession();
tx = session.beginTransaction();

} catch (HibernateException e) {
if (tx != null && tx.isActive())

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!