Hibernate

org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save()

HibernateでIDが自動生成(autoincrementのような)したい場合に、 org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save() と出る。 マッピングファイルのgeneratorクラスの設定が原因。 <id name="nid" type="int" column="nid" > <meta attribute="field-description"> </meta></id>…

Middlegenで生成したhbm.xmlファイルからオブジェクトを呼び出すと、MappingException identifier mapping has wrong number of columnsと出る

middlegenで作ったオブジェクトが一部、データタイプをObjectに変換しているのが原因。該当するhbm.xmlを開けて、以下の部分を修正する。 <id name="uid" type="java.lang.Object" <ここ column="uid" > <meta attribute="field-description"> @hibernate.id generator-class="assigned" type="java.lang.Object" <ここ column="uid" </meta> <generator class="assigned" /> </id> をこ…

hibernate: 開発環境からデプロイしたらHibernate Exception - Transaction not successfully started と出た。

開発マシンから別の環境にデプロイ(サーバー上のTOMCATに)したら、webapps自体にはちゃんと配備できてブラウザからアクセスできる。しかしデータベースとのアクセスのところになると、こんなエラーが。 Mar 31, 2008 10:06:24 AM org.apache.catalina.core…

hibernate: many-to-oneの外部キーでデータを取ろうとしたら、IllegalArgumentException occurred calling getter of と出る。

1年ぶりにHibernateをつかったらつまらないところでハマった。バージョンはHibernate 3.2.5。やりたいことは単純に、ユーザーであるadministratorのIDに紐づいているデータをjava.util.Listとして受け取りたいだけ。 select * from history where administra…