facebook

hibernate mysql insert problem

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #282246 Reply

    trotzky
    Member

    Hi all
    I am relatively new to hibernate. however, i come from a a mysql-background, thats why this sounds so strange – maybe someone here has seen something similar….

    i was easily able to reverse engineer the relevant mapping classes for my mysql-db (thanks myeclipse team!). selects work like a charm but if i want to insert a record (with generator-class native, tried some others, but no difference), it does not show up. according to mysql.log, the insert ist perfectly valid and gets executed, but is simply not there if i “select * from foo” –

    however, the row holding the primary key (and set on autoincrement by mysql) counts up. means, if insert a record by hand – the key reflects the former insert by hibernate. difficult to explain:
    last_id: 14, then i do an insert by hibernate, no new row visible, then i do an insert by hand – new last_id: 16.

    i know this is not strictly myeclipse -but hey, can’t hurt to try? 🙂

    any help appreciated…

    chris

    #282264 Reply

    Loyal Water
    Member

    Chris,
    I think you will have to use transaction management in your code. That should get you going.

    #282283 Reply

    trotzky
    Member

    Hi nipun
    thanks for the quick and helpful reply! you pointed me in the exact right direction!

    Just in case somebody else ever stops by this thread – this is the solution:
    https://www.genuitec.com/forums/topic/hibernate-spring-tutorial-on-latest-myeclipse-no-data/

    cheers, chris

    #282298 Reply

    Loyal Water
    Member

    Your Welcome.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: hibernate mysql insert problem

You must be logged in to post in the forum log in