Java, Spring + HibernateHibernateってあまり日本では使われていないんでしょうか。入門とかは結構あるけど・・・。例外名で検索してもあまり日本のサイトって出てきませんね。しょっちゅうよく分からない例外を発生させてしまうのは自分だけなのか・・・。 org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session というわけで今回は「org.hibernate.NonUniqueObjectException」について書きます。例外名だけみると単純にオブジェクトが一意じゃないという例外です。例外メッセージは「a different object with the same i
Hibernate では2次キャッシュ(query cache と collection cache 含む)を提供していますが、キャッシュプロバイダ実装の選定とか、実案件への適用ポリシー等についてはユーザーにお任せですよね。自由度が高いというメリットはあるけど、自由を持て余してしまうかもしれません。 ということで、利用者の視点で、少し考えてみようと思います。 本家の情報 ひとまず、以下に Hibernate 本家のキャッシュに関する情報をまとめてみました。 Hibernate Core 3.4.4. Second-level and query cache 19.2. The Second Level Cache 19.3. Managing the caches 19.4. The Query Cache 19.6.2. Metrics 24. Best Practices Hibern
One of the nice things about using Hibernate in your persistence layer is that it can automatically make updates to your database schema for you. This is nice in development, but oftentimes you need to have the ddl script file. Lucky for us, Hibernate ships with the SchemaExport class. This is what hibernate uses to make updates to your database. I'll show you how we can hijack it and use it for o
HibernateをSpringで動かすと、Hibernateで発生したExceptionをSpringが変換して投げてくれる。 Hibernate PK検索でデータが存在しなかった場合 org.hibernate.ObjectNotFoundException 登録、更新時に一意制約違反がおきた場合 org.hibernate.exception.ConstraintViolationException 更新、削除時に楽観的ロック例外が発生した場合、または対象データが存在しなかった場合 org.hibernate.StaleObjectStateException 上記のExceptionが以下のExceptionに変換される。 Spring PK検索でデータが存在しなかった場合 org.springframework.orm.hibernate3.HibernateObjectRetr
Red Hat Insights Increase visibility into IT operations to detect and resolve technical issues before they impact your business. Learn More Go to Insights Red Hat Product Security Center Engage with our Red Hat Product Security team, access security updates, and ensure your environments are not exposed to any known security vulnerabilities. Product Security Center
Red Hat Insights Increase visibility into IT operations to detect and resolve technical issues before they impact your business. Learn More Go to Insights Red Hat Product Security Center Engage with our Red Hat Product Security team, access security updates, and ensure your environments are not exposed to any known security vulnerabilities. Product Security Center
今回は、Spring+HibernateEntityManager(@Required編)の続きです。 トランザクションがかからない!? 現在は、ServiceImpl#registerUser(User) メソッドに、@Transactional アノテーションを用いてトランザクションをかけています。 @Transactional public void registerUser(User<Integer> user) { getEntityManager().persist(user); } ここで、このメソッドにバリデーションをかけるために、メソッドを分割しようとおもいます。 ということで、現在1つのメソッドを、下記の3つのメソッドに分割してみます。 元の registerUser メソッドを、下記の2メソッドを呼び出すようにして、@Transaction アノテーションを削除。 U
IBMのサイトにHibernateとSpring AOPで、汎用性と型安全性を備えたDAOを作るという非常に興味深い記事を発見。これは業務アプリを作るときにいつも作成するDAOを効率よく作成する方法をまとめた記事です。通常DAOの作成って、エンティティごとに似たようなコーディングをしなくてはいけなくてひじょーに煩わしいのですが、GenericsとSpringを使うことによってこの面倒な作業から解放されます。目からウロコですね。 やってみる † エンティティなどはHibernate/Springを使ってトランザクション処理を記述するのものをそのまま流用します。 DDL create table MKINO.USER_ATTR ( USERID varchar2(100) not null, NAME varchar2(1000), primary key (USERID) ); クラス図 ま
<<<<< JDBC vs Hibernate vs iBATIS vs S2DAO (vs TopLink) >>>>> 流行りのORMapperを習得しながら、機能や速度を比較してみようという企画です。 注意! この記事には、性能比較データを載せていますが、あくまで一つの切り口、一つの環境で計ったデータに過ぎません。 過信しすぎないよう気をつけてください。また、Oracle TopLinkについては、ライセンス上性能データを載せていません。 この記事では、以下のORMapperを取り上げています。 Hibernate iBATIS S2DAO TopLink [ダウンロード] ソース・設定ファイル・性能比較結果などの成果物は、以下の場所からダウンロードできます。 成果物一式: OR.zip (333KB) サマリのみ: ORresult.pdf (72KB) [そもそも] 連載:Hib
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く