Davide D'Alto (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMDAzZGVhMjYz...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15771?atlOrigin=eyJpIjoiMDAzZG...
) HHH-15771 (
https://hibernate.atlassian.net/browse/HHH-15771?atlOrigin=eyJpIjoiMDAzZG...
) org.hibernate.query.SemanticException: Could not interpret path expression (
https://hibernate.atlassian.net/browse/HHH-15771?atlOrigin=eyJpIjoiMDAzZG...
)
Change By: Davide D'Alto (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
The following
[
test|https://github.com/DavideD/hibernate-test-case-templates/blob/test-c...]:
{code:java}public class ORMStandaloneTestCase {
private SessionFactory sf;
@Before
public void setup() {
StandardServiceRegistryBuilder srb = new StandardServiceRegistryBuilder()
// Add in any settings that are specific to your test. See resources/hibernate.properties
for the defaults.
.applySetting( "hibernate.show_sql", "true" )
.applySetting( "hibernate.format_sql", "true" )
.applySetting( "hibernate.hbm2ddl.auto", "update" );
Metadata metadata = new MetadataSources( srb.build() )
// Add your entities here.
.addAnnotatedClass( Thing.class )
.buildMetadata();
sf = metadata.buildSessionFactory();
}
// Add your tests, using standard JUnit.
final Thing thing = new Thing();
@Test
public void testORM() {
thing.localDateTime = LocalDateTime.now()
.truncatedTo( ChronoUnit.MILLIS );
try (Session session = sf.openSession()) {
session.beginTransaction();
session.persist( thing );
session.getTransaction().commit();
}
try (Session session = sf.openSession()) {
List<Thing> dt = session.createSelectionQuery( "from Thing where
localDateTimeType=:dt", Thing.class )
.setParameter( "dt", thing.getLocalDateTime() )
.list();
Assertions.assertNotNull( dt );
}
}
@Entity(name = "Thing")
public static class Thing {
@Id
@GeneratedValue
long id;
@Column(name = "dateType")
Date date;
@Column(name = "calendarType")
Calendar calendar;
@Column(name = "offsetDateTimeType")
OffsetDateTime offsetDateTime;
@Column(name = "offsetTimeType")
OffsetTime offsetTime;
@Column(name = "zonedDateTimeType")
ZonedDateTime zonedDateTime;
@Column(name = "localDateType")
LocalDate localDate;
@Column(name = "localTimeType")
LocalTime localTime;
@Column(name = "localDateTimeType")
LocalDateTime localDateTime;
public Date getDate() {
return date;
}
public Calendar getCalendar() {
return calendar;
}
public OffsetDateTime getOffsetDateTime() {
return offsetDateTime;
}
public OffsetTime getOffsetTime() {
return offsetTime;
}
public ZonedDateTime getZonedDateTime() {
return zonedDateTime;
}
public LocalDate getLocalDate() {
return localDate;
}
public LocalTime getLocalTime() {
return localTime;
}
public LocalDateTime getLocalDateTime() {
return localDateTime;
}
}{code}
Throws:
{noformat}org.hibernate.query.SemanticException: Could not interpret path expression
'localDateTimeType'{noformat}
(
https://hibernate.atlassian.net/browse/HHH-15771#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15771#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100210- sha1:eab5823 )