delete test I did not mean to commit
This commit is contained in:
parent
d8944e2326
commit
7cc701902d
|
@ -1,43 +0,0 @@
|
|||
package org.hibernate;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Convert;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SessionFactory
|
||||
@DomainModel (annotatedClasses = {BugTest.MyInstance.class, BugTest.My.class})
|
||||
public class BugTest {
|
||||
|
||||
@Test void test(SessionFactoryScope scope) {
|
||||
scope.inTransaction( s -> s.persist( new My() ) );
|
||||
scope.inTransaction(
|
||||
s -> s.createMutationQuery("update My m set m.smallintCol = cast(1 as Short)")
|
||||
.executeUpdate()
|
||||
);
|
||||
}
|
||||
|
||||
@MappedSuperclass
|
||||
static abstract class MyInstance {
|
||||
@Column(name = "iface_ids", columnDefinition = "TEXT")
|
||||
@Convert(converter = StringListToStringConverter.class)
|
||||
List<String> interfaceIds = List.of("a", "b", "c");
|
||||
}
|
||||
|
||||
@Entity(name="My")
|
||||
static class My extends MyInstance {
|
||||
@Id @GeneratedValue
|
||||
Long id;
|
||||
|
||||
@Column(name = "smallint_col", nullable = false)
|
||||
private short smallintCol;
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package org.hibernate;
|
||||
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class StringListToStringConverter implements AttributeConverter<List<String>, String> {
|
||||
@Override
|
||||
public String convertToDatabaseColumn(List<String> attribute) {
|
||||
return attribute.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> convertToEntityAttribute(String dbData) {
|
||||
return Arrays.asList( dbData.split(",") );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue