HHH-18102 - Test case showing the problem
This commit is contained in:
parent
fd3cb949a7
commit
6bf358d324
|
@ -0,0 +1,31 @@
|
|||
package org.hibernate.processor.test.constant;
|
||||
|
||||
import org.hibernate.processor.test.util.CompilationTest;
|
||||
import org.hibernate.processor.test.util.TestForIssue;
|
||||
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;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
@TestForIssue(jiraKey = "HHH-No-Such-Key")
|
||||
public class BadEnumConstantInNamedQueryTest extends CompilationTest {
|
||||
|
||||
@Test
|
||||
@WithClasses({ CookBook.class })
|
||||
public void testFourthWithoutCheckHQL() {
|
||||
System.out.println( getMetaModelSourceAsString( CookBook.class ) );
|
||||
assertMetamodelClassGeneratedFor( CookBook.class );
|
||||
assertPresenceOfFieldInMetamodelFor( CookBook.class, "QUERY_FIND_GOOD_BOOKS" );
|
||||
assertThrows(
|
||||
AssertionError.class,
|
||||
() -> assertPresenceOfMethodInMetamodelFor( CookBook.class, "findGoodBooks", EntityManager.class )
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package org.hibernate.processor.test.constant;
|
||||
|
||||
public enum BookType {
|
||||
GOOD, BAD, UGLY;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package org.hibernate.processor.test.constant;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.NamedQuery;
|
||||
|
||||
@Entity
|
||||
@NamedQuery(name = "#findGoodBooks",
|
||||
query = "from CookBook where bookType = org.hibernate.processor.test.constant.BookType.GOOD_BOOK")
|
||||
public class CookBook {
|
||||
|
||||
@Id
|
||||
String isbn;
|
||||
String title;
|
||||
BookType bookType;
|
||||
}
|
Loading…
Reference in New Issue