Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ public class Record {
@Id @GeneratedValue
String id;
String text;
LocalDateTime timestamp = LocalDateTime.now();
LocalDateTime timestamp;
Record() {}
public Record(String text) {
public Record(String text, LocalDateTime timestamp) {
this.text = text;
this.timestamp = timestamp;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,21 @@
*/
package org.hibernate.orm.test.jpa.metadata;

import org.hibernate.community.dialect.FirebirdDialect;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.SybaseASEDialect;
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
import org.hibernate.testing.orm.junit.Jpa;
import org.hibernate.testing.orm.junit.SkipForDialect;
import org.junit.jupiter.api.Test;

import java.time.LocalDate;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;

@Jpa(annotatedClasses = Record.class)
public class TypesafeNamedQueryTest {
@SkipForDialect(dialectClass = SybaseASEDialect.class, reason = "'order by timestamp, id' not quite working")
@SkipForDialect(dialectClass = FirebirdDialect.class, reason = "'order by timestamp, id' not quite working")
@SkipForDialect(dialectClass = InformixDialect.class, reason = "'order by timestamp, id' not quite working")
@Test void test(EntityManagerFactoryScope scope) {
scope.inTransaction( entityManager -> {
Record record1 = new Record("Hello, World!");
Record record2 = new Record("Goodbye!");
Record record1 = new Record("Hello, World!", LocalDate.EPOCH.atStartOfDay());
Record record2 = new Record("Goodbye!", LocalDate.EPOCH.atStartOfDay().plusSeconds( 1L ));
entityManager.persist(record1);
entityManager.persist(record2);
String text = entityManager.createQuery(Record_._TextById_).setParameter(1, record1.id).getSingleResult();
Expand Down
Loading