• Post Reply Bookmark Topic Watch Topic
  • New Topic

Generic way of writing @SqlInsert ?

Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm using Hibernate 4.0.1.Final. I have a table with a unique column ...

In my DAO, I'd like to be able to write a "createOrUpdate" method such that if there is an object matching the unique key, all I do is update that object, otherwise, a new object is created. I wanted to use the @SQLInsert annotation for this ...

However, in some JUnit tests, we use the HSSQL in-memory database, whereas in other cases we use MySQL 5.5. Is there a less vendor-specific way to accomplish the @SQLInsert without resorting to vendor-specific SQL?

Thanks, - Dave
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!