add additional HQL bulk tests

- failing test for secondary table update
- failing test for embeddable update
- passing test for secondary table delete
This commit is contained in:
gavinking 2020-02-22 15:07:52 +01:00 committed by Steve Ebersole
parent e90207e651
commit 02cd346d3f
1 changed files with 38 additions and 1 deletions

View File

@ -7,18 +7,23 @@
package org.hibernate.orm.test.query.hql;
import org.hibernate.testing.orm.domain.StandardDomainModel;
import org.hibernate.testing.orm.domain.contacts.Contact;
import org.hibernate.testing.orm.domain.contacts.Contact.Name;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
import java.time.LocalDate;
/**
* @author Gavin King
*/
@SuppressWarnings("WeakerAccess")
@ServiceRegistry
@DomainModel( standardModels = StandardDomainModel.HELPDESK )
@DomainModel( standardModels = {StandardDomainModel.HELPDESK, StandardDomainModel.CONTACTS} )
@SessionFactory
public class InsertUpdateTests {
@ -33,6 +38,24 @@ public class InsertUpdateTests {
);
}
@Test @FailureExpected(reason = "update broken for secondary tables")
public void testUpdateSecondaryTable(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
session.createQuery("update Contact set birthDay = local date").executeUpdate();
}
);
}
@Test @FailureExpected(reason = "update broken for embedded")
public void testUpdateEmbedded(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
session.createQuery("update Contact set name.first = 'Hibernate'").executeUpdate();
}
);
}
@Test
public void testDelete(SessionFactoryScope scope) {
scope.inTransaction(
@ -43,6 +66,20 @@ public class InsertUpdateTests {
);
}
@Test
public void testDeleteSecondaryTable(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
Contact contact = new Contact();
contact.setId(5);
contact.setName( new Name("Hibernate", "ORM") );
contact.setBirthDay( LocalDate.now() );
session.persist(contact);
session.createQuery("delete from Contact").executeUpdate();
}
);
}
@Test
public void testInsertValues(SessionFactoryScope scope) {
scope.inTransaction(