• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Hibernate, everything in logger looks ok, but no row is inserted

Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am getting strange problem with Hibernate.

I have following sourcecode:

In output everything seems to be ok for me:

2009-10-02 18:51:13 org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.3.1.GA
2009-10-02 18:51:13 org.hibernate.cfg.Environment <clinit>
more INFO's....

Customer ID: 0

Name: Name, Surname: Surname
rest of toString() method

INFO: configuring from resource: /hibernate.cfg.xml

more INFO's...

2009-10-02 18:51:16 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: schema update complete
Hibernate: insert into Adress (street, number, city, zip, region, country, state) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into ContactInfo (cell, phone, fax, email) values (?, ?, ?, ?)
Hibernate: insert into Customer (name, surname, created, adress, contact, company) values (?, ?, ?, ?, ?, ?)
Customer ID: 1035
..toString method()
Created: null

Notice that ID has changed, it means that hibernate properly assigned auto increment value from db, however created properties which is current timestamp is null
and I have no new row in the db.
It's strange but if I do the same insert operation in a simply class without getting customer from view it works, just put customer object creation to main() method everything works fine.

Could anybody give me any advice, please?


Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marek,

it would be useful if you'd provide some mapping info on your involved entities, probably mapping files. Just posting the code of the session actions says closely to nothing.

I am also not really sure if I really got your problem. Your info is quite confusing and probably incomplete.

    Bookmark Topic Watch Topic
  • New Topic