Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and MS SQL Server 2005 with replication

 
John Sutt
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If MS SQL 2005 is configured to do replication, it adds an additional column named msrepl_tran_version to each table.
This column breaks some of my code, for instance:
1) Hibernate intelligently discovers some tables are link tables (if that is the correct English term). Say I have Table A and Table B,
and link table AB has only A and B's private keys. Now, Hibernate adds a set of C's to class A, and I can program a.getCs().
After the msrepl_tran version column is added, if I reverse-engineer again, Hiberate suddenly does not consider AB to be a link table anymore.
2) I have some code that creates new A's. I use getHibernateTemplate().saveOrUpdate(a) to store these.
This fails because the msrepl_tran_version has a NOT NULL constraint.

Is it possible to completely ignore this msrepl_tran_version column?
I have tried things like this:


but this does not seem to work, the msreplTranVersion property is still there in the Mytab pojo.

Has anybody had this problem before and/or can give me some advice?
Thanks in advance,
John.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic