Wednesday, June 29, 2011

Writing to a DB with Hibernate

Finally I managed to solve that really old problem of writing into database with the Hibernate approach. (see post from 12.02.2011)
Previously I was thinking, that just as reading from a DB it should be working with HQL queries. They didn't work.

Now I know how to do it correctly: there is a safer method in the Hibernate session - saveOrUpdate. It simply writes an instance of a Hibernate-generated database entity class in to the base. And of course it is possible to use transaction for that. 

No comments:

Post a Comment