mike.griffin wrote:All of the NHibernate are user submitted, look at this post:
http://www.mygenerationsoftware.com/php ... php?t=1505
Find out whose you're using and if you go to thier archive on the template library you can post a message there and it will be sent directly to the author. You might have to register on the Template Library but it's very easy.
gekannt wrote:Are you using a composite primary key, i.e. a primary key with more than one column?
gekannt wrote:The reason I ask is that the OM - 0.7.1 template has some support for composite keys, but the other three templates do not, which would explain the difference in behavior when using MySQL 5.x.. However, last I checked, the composite key support in that template was incomplete. (Disclaimer: I'm not the author of that template; my answers can't be considered authoritative.)
gekannt wrote:If that's the case, you have a few options. If you have control over the database schema, you could use a synthetic primary key instead.
gekannt wrote:Or, you could write the .hbm files yourself. NHibernate does support composite primary keys, even though they're not recommended.
gekannt wrote:Finally, you might look at http://www.objectmapper.com, which is another (recently) free tool that has some support for generating NHibernate mappings. It's slower and not nearly as customizeable as MyGeneration, and the class files it generates leave something to be desired in my opinion, but when I looked at it a few months ago, it was a little better than the existing MyGeneration templates at handling odd database schemas. It might do composite keys; I don't know.
gekannt wrote:If that's not the case, if you're not using a composite key, can you post the table schema and .hbm.xml file that's generated from the 1.1 template?
I'm sorry, but what is a \"synthetic primary key\"?
gekannt wrote:I'm sorry, but what is a "synthetic primary key"?
A synthetic key is a number that doesn't have any meaning in the problem domain, it's just used internally by the database. So to use a synthetic primary key, you'd add a new autoincremented integer column to your table, set that as the primary key, add a unique constraint for the columns from your old primary key, and change any foreign keys or constraints or whatever referring to your old composite key to refer to the new key.
It's a bit controversial whether it's better to use synthetic or "natural" keys (i.e. unique values that have real world meaning, e.g. SSN). I'm in the synthetic camp myself, but that's a flamewar beyond the scope of this thread.
Users browsing this forum: No registered users and 0 guests