forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#26491 from famod/spring-data-parent-id-t…
…yped Fix spring-data-jpa field lookup in parameterized superclasses and for typed fields
- Loading branch information
Showing
8 changed files
with
126 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...ests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/AbstractPhoneEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.quarkus.it.spring.data.jpa; | ||
|
||
import javax.persistence.MappedSuperclass; | ||
|
||
// demonstrates that @MappedSuperclass detection works for more than one level and for parameterized types | ||
@MappedSuperclass | ||
public abstract class AbstractPhoneEntity<ID extends PhoneNumberId> extends AbstractTypedIdEntity<ID> { | ||
|
||
protected AbstractPhoneEntity(ID id) { | ||
super(id); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ts/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/AbstractTypedIdEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.quarkus.it.spring.data.jpa; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.persistence.EmbeddedId; | ||
import javax.persistence.MappedSuperclass; | ||
|
||
// example "base entity" using strongly typed ids (instead of just long) | ||
@MappedSuperclass | ||
public abstract class AbstractTypedIdEntity<ID extends Serializable> { | ||
|
||
@EmbeddedId | ||
private ID id; | ||
|
||
protected AbstractTypedIdEntity(ID id) { | ||
this.id = id; | ||
} | ||
|
||
public ID getId() { | ||
return id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PhoneCallId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.quarkus.it.spring.data.jpa; | ||
|
||
import javax.persistence.Embeddable; | ||
|
||
@Embeddable | ||
public class PhoneCallId extends PhoneNumberId { | ||
|
||
PhoneCallId() { | ||
} | ||
|
||
public PhoneCallId(String areaCode, String number) { | ||
super(areaCode, number); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters