HHH-18278 - Test case:
Metamodel generator should generate classes org.hibernate.processor.test.packageinfo.Message_ and org.hibernate.processor.test.packageinfo.packageinfo_ With later containing fields QUERY_FIND_BY_KEY and QUERY_FIND_BY_ID_AND_KEY, and method findByKey
This commit is contained in:
parent
05dc7b2612
commit
62a89e6d30
|
@ -0,0 +1,43 @@
|
|||
package org.hibernate.processor.test.packageinfo;
|
||||
|
||||
import org.hibernate.processor.test.util.CompilationTest;
|
||||
import org.hibernate.processor.test.util.WithClasses;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
|
||||
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
|
||||
import static org.hibernate.processor.test.util.TestUtil.assertPresenceOfFieldInMetamodelFor;
|
||||
import static org.hibernate.processor.test.util.TestUtil.assertPresenceOfMethodInMetamodelFor;
|
||||
import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString;
|
||||
|
||||
public class PackageInfoMetamodelTest extends CompilationTest {
|
||||
|
||||
@Test
|
||||
@WithClasses(value = {}, sources = {
|
||||
"org.hibernate.processor.test.packageinfo.Message",
|
||||
"org.hibernate.processor.test.packageinfo.package-info"
|
||||
})
|
||||
public void test() {
|
||||
assertMetamodelClassGeneratedFor( "org.hibernate.processor.test.packageinfo.Message" );
|
||||
|
||||
System.out.println( getMetaModelSourceAsString( "org.hibernate.processor.test.packageinfo.packageinfo" ) );
|
||||
|
||||
assertPresenceOfFieldInMetamodelFor(
|
||||
"org.hibernate.processor.test.packageinfo.packageinfo",
|
||||
"QUERY_FIND_BY_KEY"
|
||||
);
|
||||
assertPresenceOfFieldInMetamodelFor(
|
||||
"org.hibernate.processor.test.packageinfo.packageinfo",
|
||||
"QUERY_FIND_BY_ID_AND_KEY"
|
||||
);
|
||||
|
||||
assertPresenceOfMethodInMetamodelFor(
|
||||
"org.hibernate.processor.test.packageinfo.packageinfo",
|
||||
"findByKey",
|
||||
EntityManager.class,
|
||||
String.class
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package org.hibernate.processor.test.packageinfo;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class Message {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
String key;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
@NamedQuery(
|
||||
name = "#findByKey",
|
||||
query = "from Message where key=:key")
|
||||
@NamedQuery(
|
||||
name = "findByIdAndKey",
|
||||
query = "from Message where id=:id and key=:key")
|
||||
|
||||
package org.hibernate.processor.test.packageinfo;
|
||||
|
||||
import org.hibernate.annotations.NamedQuery;
|
Loading…
Reference in New Issue