0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[ハマリネタ]Entityクラスの中でJava 8 lambda式を使用すると、Entityクラスが読み込まれない

Last updated at Posted at 2015-10-08

背景

Entityクラスの中でlambda式を使用していました。

例えばこんな風に。

  myCollection.stream().forEach(i -> i.setDate(now));

そうすると、そのEntityクラスは読み込まれず、リレーションシップなどで使用していると、次のようなエラーが出ます。

[class com.example.Hoge] uses a non-entity [class com.example.fuga] as target entity in the relationship attribute [field hoge]

環境

  • Glassfish 4
  • Java 8

原因

Eclipselinkのバグでしたー。 :sob: :sob: :sob:

Bug 429992 - EclipseLink silently ignores Entity classes with lambda expressions

回避策

lambda式を使うのをやめましょー。 :sweat:

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?