Hi,
I've just been struggling to get Hibernate 3.1RC2 to work with SQLServer 2000 and came across a couple of issues when working with (quite simple) many-to-many relationships. I am using the schema (="catmgr") setting in the class level definition which works fine for ordinary table access by appending it to the tablename (="catmgr.RC_CATEGORY"). However, when doing it for many-to-many relationships, the schema is not prepended to the X-Ref table name (="RC_PRODUCT_CATEGORY"). I therefore have to add it manually to the set and many-to-many relationship to stop the Hibernate-generated SQL statement messing up.
from Category.hbm.xml:
Code:
<!-- products in this category -->
<set name="products" table="catmgr.RC_PRODUCT_CATEGORY" lazy="false" cascade="save-update">
<key column="CATEGORY_ID"/>
<many-to-many class="com.minimaster.catalogue.ibase.Product" column="PRODUCT_ID"/>
</set>
Can anyone confirm they have the same problem, and that it is a problem (and not me) - if so, I'll report a bug?
-david
P/S:
Also, for those having to use SQLServer 2000, if you have many-to-many relationships and are using Tomcat/JDBC (with JDBC level transactions), and aren't using lazy associations, then you'll need to add the SelectMethod=Cursor option to the connection configuration string so that it'll set up server-side cursors to cope with the complexity of loading *everything*.
From hibernate.cfg.xml:
Code:
<property name="connection.url">jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=*****;SelectMethod=Cursor</property>