Skip to content

Commit ecdd594

Browse files
gavinkinglukasj
authored andcommitted
add Metamodel.entity(String)
see #85
1 parent 5f826c6 commit ecdd594

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

api/src/main/java/jakarta/persistence/metamodel/Metamodel.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212

1313
// Contributors:
14+
// Gavin King - 3.2
1415
// Linda DeMichiel - 2.1
1516
// Linda DeMichiel - 2.0
1617

@@ -26,6 +27,16 @@
2627
*/
2728
public interface Metamodel {
2829

30+
/**
31+
* Return the metamodel entity type representing the entity.
32+
* @param entityName the name of the represented entity
33+
* @return the metamodel entity type
34+
* @throws IllegalArgumentException if not an entity
35+
* @see jakarta.persistence.Entity#name
36+
* @since 3.2
37+
*/
38+
EntityType<?> entity(String entityName);
39+
2940
/**
3041
* Return the metamodel entity type representing the entity.
3142
* @param cls the type of the represented entity

spec/src/main/asciidoc/appendixes.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,5 @@ Entity and embeddable classes may now be static inner classes
137137
Primary key classes are no longer required to be public and serializable
138138

139139
Pulled _getParameters()_ up from _CriteriaQuery_ to _CommonAbstractCriteria_
140+
141+
Add overload of _entity()_ accepting an entity name to _Metamodel_

spec/src/main/asciidoc/ch05-metamodel-api.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ import java.util.Set;
3838
*/
3939
public interface Metamodel {
4040
41+
/**
42+
* Return the metamodel entity type representing the entity.
43+
* @param entityName the name of the represented entity
44+
* @return the metamodel entity type
45+
* @throws IllegalArgumentException if not an entity
46+
* @see jakarta.persistence.Entity#name
47+
* @since 3.2
48+
*/
49+
EntityType<?> entity(String entityName);
50+
4151
/**
4252
* Return the metamodel entity type representing the entity.
4353
* @param cls the type of the represented entity

0 commit comments

Comments
 (0)