code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
public int getQuantity() {
return quantity;
} | Simple tests that aggregated id mappings work at a basic level
@author Steve Ebersole | getQuantity | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/cid/nonaggregated/SmokeTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/cid/nonaggregated/SmokeTests.java | Apache-2.0 |
public void setQuantity(int quantity) {
this.quantity = quantity;
} | Simple tests that aggregated id mappings work at a basic level
@author Steve Ebersole | setQuantity | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/cid/nonaggregated/SmokeTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/cid/nonaggregated/SmokeTests.java | Apache-2.0 |
@Test
void verifyModel(DomainModelScope scope) {
scope.withHierarchy( AnEntity.class, (descriptor) -> {
final Property implicitList = descriptor.getProperty( "implicitList" );
// this is the purpose of the new AvailableSettings#DEFAULT_LIST_SEMANTICS
// setting to allow legacy behavior.
assertThat( impli... | Explicitly sets {@value AvailableSettings#DEFAULT_LIST_SEMANTICS} to BAG
and verifies the outcome.
Basically verifies that the legacy behavior can be achieved via the setting
for users migrating who wish to retain that legacy behavior
@author Steve Ebersole | verifyModel | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListAsBagSemanticsTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListAsBagSemanticsTests.java | Apache-2.0 |
public Integer getId() {
return id;
} | Explicitly sets {@value AvailableSettings#DEFAULT_LIST_SEMANTICS} to BAG
and verifies the outcome.
Basically verifies that the legacy behavior can be achieved via the setting
for users migrating who wish to retain that legacy behavior
@author Steve Ebersole | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListAsBagSemanticsTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListAsBagSemanticsTests.java | Apache-2.0 |
public String getName() {
return name;
} | Explicitly sets {@value AvailableSettings#DEFAULT_LIST_SEMANTICS} to BAG
and verifies the outcome.
Basically verifies that the legacy behavior can be achieved via the setting
for users migrating who wish to retain that legacy behavior
@author Steve Ebersole | getName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListAsBagSemanticsTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListAsBagSemanticsTests.java | Apache-2.0 |
public void setName(String name) {
this.name = name;
} | Explicitly sets {@value AvailableSettings#DEFAULT_LIST_SEMANTICS} to BAG
and verifies the outcome.
Basically verifies that the legacy behavior can be achieved via the setting
for users migrating who wish to retain that legacy behavior
@author Steve Ebersole | setName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListAsBagSemanticsTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListAsBagSemanticsTests.java | Apache-2.0 |
@Test
void verifyModel(DomainModelScope scope) {
scope.withHierarchy( AnEntity.class, (descriptor) -> {
final Property implicitList = descriptor.getProperty( "implicitList" );
// this is the change related to AvailableSettings#DEFAULT_LIST_SEMANTICS
// previous versions interpreted these as BAG
assertTha... | Uses the default {@value AvailableSettings#DEFAULT_LIST_SEMANTICS} value of LIST
and verifies the outcome
@author Steve Ebersole | verifyModel | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListDefaultSemanticsTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListDefaultSemanticsTests.java | Apache-2.0 |
public Integer getId() {
return id;
} | Uses the default {@value AvailableSettings#DEFAULT_LIST_SEMANTICS} value of LIST
and verifies the outcome
@author Steve Ebersole | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListDefaultSemanticsTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListDefaultSemanticsTests.java | Apache-2.0 |
public String getName() {
return name;
} | Uses the default {@value AvailableSettings#DEFAULT_LIST_SEMANTICS} value of LIST
and verifies the outcome
@author Steve Ebersole | getName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListDefaultSemanticsTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListDefaultSemanticsTests.java | Apache-2.0 |
public void setName(String name) {
this.name = name;
} | Uses the default {@value AvailableSettings#DEFAULT_LIST_SEMANTICS} value of LIST
and verifies the outcome
@author Steve Ebersole | setName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListDefaultSemanticsTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/ImplicitListDefaultSemanticsTests.java | Apache-2.0 |
@BeforeEach
public void createData(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
final EntityOfMaps entityContainingMaps = new EntityOfMaps( 1, "first-map-entity" );
entityContainingMaps.addBasicByBasic( "someKey", "someValue" );
entityContainingMaps.addBasicByBasic( "anotherKey",... | @author Steve Ebersole
@author Fabio Massimo Ercoli | createData | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | Apache-2.0 |
@AfterEach
public void dropData(SessionFactoryScope scope, DomainModelScope domainModelScope) {
// there is a problem with deleting entities which have basic collections. for some reason those
// do not register as cascadable, so we do not delete the collection rows first
scope.inTransaction(
session -> {
... | @author Steve Ebersole
@author Fabio Massimo Ercoli | dropData | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | Apache-2.0 |
@Test
public void testSqmFetching(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
final EntityOfMaps entity = session.createQuery(
"select e from EntityOfMaps e join fetch e.basicByEnum",
EntityOfMaps.class
).getSingleResult();
assert Hibernate.isInitialized( entity.g... | @author Steve Ebersole
@author Fabio Massimo Ercoli | testSqmFetching | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | Apache-2.0 |
@Test
public void testDelete(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
final EntityOfMaps entity = session.createQuery(
"select e from EntityOfMaps e join fetch e.basicByEnum",
EntityOfMaps.class
).getSingleResult();
session.remove( entity );
}
);
// re... | @author Steve Ebersole
@author Fabio Massimo Ercoli | testDelete | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | Apache-2.0 |
@Test
public void testSortedMapAccess(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
final EntityOfMaps entity = session.get( EntityOfMaps.class, 1 );
assertThat( entity.getSortedBasicByBasic(), InitializationCheckMatcher.isNotInitialized() );
// trigger the init
Hibernate.in... | @author Steve Ebersole
@author Fabio Massimo Ercoli | testSortedMapAccess | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | Apache-2.0 |
@Test
public void testSortedMapWithComparatorAccess(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
final EntityOfMaps entity = session.get( EntityOfMaps.class, 1 );
assertThat( entity.getSortedBasicByBasicWithComparator(), InitializationCheckMatcher.isNotInitialized() );
// trigge... | @author Steve Ebersole
@author Fabio Massimo Ercoli | testSortedMapWithComparatorAccess | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | Apache-2.0 |
@Test
public void testSortedMapWithSortNaturalByDefaultAccess(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
final EntityOfMaps entity = session.get( EntityOfMaps.class, 1 );
assertThat( entity.getSortedBasicByBasicWithSortNaturalByDefault(), InitializationCheckMatcher.isNotInitialized(... | @author Steve Ebersole
@author Fabio Massimo Ercoli | testSortedMapWithSortNaturalByDefaultAccess | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | Apache-2.0 |
@Test
public void testOrderedMap(SessionFactoryScope scope) {
// atm we can only check the fragment translation
final CollectionPersister collectionDescriptor = scope.getSessionFactory()
.getRuntimeMetamodels()
.getMappingMetamodel()
.findCollectionDescriptor( EntityOfMaps.class.getName() + ".component... | @author Steve Ebersole
@author Fabio Massimo Ercoli | testOrderedMap | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/MapOperationTests.java | Apache-2.0 |
@Test
public void testArrays(SessionFactoryScope scope) {
final MappingMetamodel domainModel = scope.getSessionFactory().getRuntimeMetamodels().getMappingMetamodel();
final EntityMappingType containerEntityDescriptor = domainModel.getEntityDescriptor( EntityOfArrays.class );
assertThat( containerEntityDescripto... | @author Steve Ebersole
@author Fabio Massimo Ercoli | testArrays | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/PluralAttributeMappingTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/PluralAttributeMappingTests.java | Apache-2.0 |
@Test
public void testLists(SessionFactoryScope scope) {
final MappingMetamodel domainModel = scope.getSessionFactory().getRuntimeMetamodels().getMappingMetamodel();
final EntityMappingType containerEntityDescriptor = domainModel.getEntityDescriptor( EntityOfLists.class );
assertThat( containerEntityDescriptor.... | @author Steve Ebersole
@author Fabio Massimo Ercoli | testLists | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/PluralAttributeMappingTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/PluralAttributeMappingTests.java | Apache-2.0 |
@Test
public void testSets(SessionFactoryScope scope) {
final MappingMetamodel domainModel = scope.getSessionFactory().getRuntimeMetamodels().getMappingMetamodel();
final EntityMappingType containerEntityDescriptor = domainModel.getEntityDescriptor( EntityOfSets.class );
assertThat( containerEntityDescriptor.ge... | @author Steve Ebersole
@author Fabio Massimo Ercoli | testSets | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/PluralAttributeMappingTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/PluralAttributeMappingTests.java | Apache-2.0 |
@Test
public void testMaps(SessionFactoryScope scope) {
final MappingMetamodel domainModel = scope.getSessionFactory().getRuntimeMetamodels().getMappingMetamodel();
final EntityMappingType containerEntityDescriptor = domainModel.getEntityDescriptor( EntityOfMaps.class );
assertThat( containerEntityDescriptor.ge... | @author Steve Ebersole
@author Fabio Massimo Ercoli | testMaps | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/PluralAttributeMappingTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/PluralAttributeMappingTests.java | Apache-2.0 |
@Test
void test(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
final Person person = session.createQuery( "select p from Person p", Person.class ).getSingleResult();
final SortedSet<Phone> phones = person.getPhones();
assertThat( phones, IsIterableContainingInOrder.contains(
new ... | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | test | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
@BeforeEach
void createTestData(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
final Person person = new Person();
final SortedSet<Phone> phones = new TreeSet<>(
Arrays.asList(
new Phone( "678-912-345" ),
new Phone( "234-567-891" ),
new Phone( "567-891-234" ),
... | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | createTestData | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
@AfterEach
void cleanUpTestData(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
session.createQuery( "delete Person" ).executeUpdate();
}
);
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | cleanUpTestData | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
public Long getId() {
return id;
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
public void setId(Long id) {
this.id = id;
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | setId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
public SortedSet<Phone> getPhones() {
return phones;
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | getPhones | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
public void setPhones(SortedSet<Phone> phones) {
this.phones = phones;
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | setPhones | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
public Long getId() {
return id;
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
public void setId(Long id) {
this.id = id;
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | setId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
public String getNumber() {
return number;
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | getNumber | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
public void setNumber(String number) {
this.number = number;
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | setNumber | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
@Override
public int compareTo(Phone o) {
return number.compareTo( o.getNumber() );
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | compareTo | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
@Override
public boolean equals(Object o) {
if ( this == o ) {
return true;
}
if ( o == null || getClass() != o.getClass() ) {
return false;
}
Phone phone = (Phone) o;
return Objects.equals( number, phone.number );
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | equals | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
@Override
public int hashCode() {
return Objects.hash( number );
} | Tests Hibernate-specific feature that {@link org.hibernate.annotations.SortNatural @SortNatural}
will take effect implicitly when no <i>sort</i> or <i>order</i> related annotations exist, including:
<ul>
<li>{@link org.hibernate.annotations.SortNatural @SortNatural}</li>
<li>{@link org.hibernate.annotations.Sor... | hashCode | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/SortNaturalByDefaultTests.java | Apache-2.0 |
@Id
@GeneratedValue( strategy = GenerationType.AUTO )
public Long getId() {
return id;
} | @author Gavin King
@author Steve Ebersole | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | Apache-2.0 |
private void setId(Long id) {
this.id = id;
} | @author Gavin King
@author Steve Ebersole | setId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | Apache-2.0 |
public String getAddress() {
return address;
} | @author Gavin King
@author Steve Ebersole | getAddress | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | Apache-2.0 |
public void setAddress(String type) {
this.address = type;
} | @author Gavin King
@author Steve Ebersole | setAddress | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | Apache-2.0 |
public boolean equals(Object that) {
if ( !(that instanceof Email) ) return false;
Email p = (Email) that;
return this.address.equals(p.address);
} | @author Gavin King
@author Steve Ebersole | equals | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | Apache-2.0 |
public int hashCode() {
return address.hashCode();
} | @author Gavin King
@author Steve Ebersole | hashCode | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/Email.java | Apache-2.0 |
public Integer getId() {
return id;
} | @author Gavin King
@author Steve Ebersole | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/User.java | Apache-2.0 |
public String getUserName() {
return userName;
} | @author Gavin King
@author Steve Ebersole | getUserName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/User.java | Apache-2.0 |
public void setUserName(String userName) {
this.userName = userName;
} | @author Gavin King
@author Steve Ebersole | setUserName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/User.java | Apache-2.0 |
public List<Email> getEmailAddresses() {
return emailAddresses;
} | @author Gavin King
@author Steve Ebersole | getEmailAddresses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/User.java | Apache-2.0 |
public void setEmailAddresses(IMyList<Email> emailAddresses) {
this.emailAddresses = emailAddresses;
} | @author Gavin King
@author Steve Ebersole | setEmailAddresses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/User.java | Apache-2.0 |
@Id
@GeneratedValue( strategy = GenerationType.AUTO )
public Long getId() {
return id;
} | @author Gavin King
@author Steve Ebersole | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | Apache-2.0 |
private void setId(Long id) {
this.id = id;
} | @author Gavin King
@author Steve Ebersole | setId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | Apache-2.0 |
public String getAddress() {
return address;
} | @author Gavin King
@author Steve Ebersole | getAddress | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | Apache-2.0 |
public void setAddress(String type) {
this.address = type;
} | @author Gavin King
@author Steve Ebersole | setAddress | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | Apache-2.0 |
@Override
public boolean equals(Object that) {
if ( !(that instanceof Email ) ) return false;
Email p = (Email) that;
return this.address.equals(p.address);
} | @author Gavin King
@author Steve Ebersole | equals | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | Apache-2.0 |
@Override
public int hashCode() {
return address.hashCode();
} | @author Gavin King
@author Steve Ebersole | hashCode | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/Email.java | Apache-2.0 |
@Override
public X head() {
return isEmpty() ? null : get( 0 );
} | A custom collection class that implements a simple method just for illustration.
We extend a java.util.Collection class which is required for annotations-based entities, but not xml-based.
@author David Weinberg | head | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/HeadList.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/HeadList.java | Apache-2.0 |
public Integer getId() {
return id;
} | @author Gavin King
@author Steve Ebersole | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/User.java | Apache-2.0 |
public String getUserName() {
return userName;
} | @author Gavin King
@author Steve Ebersole | getUserName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/User.java | Apache-2.0 |
public void setUserName(String userName) {
this.userName = userName;
} | @author Gavin King
@author Steve Ebersole | setUserName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/User.java | Apache-2.0 |
public IHeadList<Email> getEmailAddresses() { //can declare a custom interface type
return emailAddresses;
} | @author Gavin King
@author Steve Ebersole | getEmailAddresses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/User.java | Apache-2.0 |
public void setEmailAddresses(IHeadList<Email> emailAddresses) {
this.emailAddresses = emailAddresses;
} | @author Gavin King
@author Steve Ebersole | setEmailAddresses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/User.java | Apache-2.0 |
@Override
protected String getCacheConcurrencyStrategy() {
return "nonstrict-read-write";
} | @author Max Rydahl Andersen
@author David Weinberg | getCacheConcurrencyStrategy | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserCollectionTypeTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserCollectionTypeTest.java | Apache-2.0 |
@Test
public void testBasicOperation() {
inTransaction(
s -> {
User u = new User( 1, "max" );
u.getEmailAddresses().add( new Email("max@hibernate.org") );
u.getEmailAddresses().add( new Email("max.andersen@jboss.com") );
s.persist(u);
}
);
inTransaction(
s -> {
CriteriaBuild... | @author Max Rydahl Andersen
@author David Weinberg | testBasicOperation | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserCollectionTypeTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserCollectionTypeTest.java | Apache-2.0 |
@Id
public String getUserName() {
return userName;
} | @author Gavin King
@author Steve Ebersole | getUserName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | Apache-2.0 |
public void setUserName(String userName) {
this.userName = userName;
} | @author Gavin King
@author Steve Ebersole | setUserName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | Apache-2.0 |
@OneToMany( fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true )
@CollectionType(type = HeadListType.class )
@JoinColumn( name = "userName" )
@OrderColumn( name = "displayOrder" )
public AtomicReference<Email> getEmailAddresses() { //can declare a custom interface type
return emailAddresses... | @author Gavin King
@author Steve Ebersole | getEmailAddresses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | Apache-2.0 |
public void setEmailAddresses(AtomicReference<Email> emailAddresses) {
this.emailAddresses = emailAddresses;
} | @author Gavin King
@author Steve Ebersole | setEmailAddresses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | Apache-2.0 |
@Transient
public Map getSessionData() {
return sessionData;
} | @author Gavin King
@author Steve Ebersole | getSessionData | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | Apache-2.0 |
public void setSessionData(Map sessionData) {
this.sessionData = sessionData;
} | @author Gavin King
@author Steve Ebersole | setSessionData | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollection.java | Apache-2.0 |
@Test
void testCollectionNotCollectionFailure(ServiceRegistryScope serviceRegistryScope) {
final MetadataSources metadataSources = new MetadataSources( serviceRegistryScope.getRegistry() );
metadataSources.addAnnotatedClasses( UserWithUnimplementedCollection.class, Email.class );
try {
metadataSources.buildMe... | Test that we get an exception when an attribute whose type is not a Collection
is annotated with any of <ul>
<li>{@linkplain jakarta.persistence.ElementCollection}</li>
<li>{@linkplain jakarta.persistence.OneToMany}</li>
<li>{@linkplain jakarta.persistence.ManyToMany}</li>
<li>{@linkplain org.hibernate.... | testCollectionNotCollectionFailure | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollectionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/declaredtype/UserWithUnimplementedCollectionTest.java | Apache-2.0 |
public String getDefaultValue() {
return defaultValue;
} | Implementation of our specialized collection contract
@author Holger Brands
@author Steve Ebersole | getDefaultValue | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListImpl.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListImpl.java | Apache-2.0 |
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
} | Implementation of our specialized collection contract
@author Holger Brands
@author Steve Ebersole | setDefaultValue | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListImpl.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListImpl.java | Apache-2.0 |
@Override
public CollectionClassification getClassification() {
return CollectionClassification.LIST;
} | Our Hibernate type-system extension for defining our specialized collection
contract.
@author Holger Brands
@author Steve Ebersole | getClassification | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | Apache-2.0 |
@Override
public Class<?> getCollectionClass() {
return DefaultableList.class;
} | Our Hibernate type-system extension for defining our specialized collection
contract.
@author Holger Brands
@author Steve Ebersole | getCollectionClass | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | Apache-2.0 |
public Object instantiate(int anticipatedSize) {
DefaultableListImpl list = anticipatedSize < 0 ? new DefaultableListImpl() : new DefaultableListImpl( anticipatedSize );
list.setDefaultValue( defaultValue );
return list;
} | Our Hibernate type-system extension for defining our specialized collection
contract.
@author Holger Brands
@author Steve Ebersole | instantiate | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | Apache-2.0 |
@Override
public PersistentCollection instantiate(
SharedSessionContractImplementor session,
CollectionPersister persister) {
return new PersistentDefaultableList( session );
} | Our Hibernate type-system extension for defining our specialized collection
contract.
@author Holger Brands
@author Steve Ebersole | instantiate | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | Apache-2.0 |
@Override
public PersistentCollection wrap(SharedSessionContractImplementor session, Object collection) {
return new PersistentDefaultableList( session, ( List ) collection );
} | Our Hibernate type-system extension for defining our specialized collection
contract.
@author Holger Brands
@author Steve Ebersole | wrap | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | Apache-2.0 |
@Override
public Iterator getElementsIterator(Object collection) {
return ( ( DefaultableList ) collection ).iterator();
} | Our Hibernate type-system extension for defining our specialized collection
contract.
@author Holger Brands
@author Steve Ebersole | getElementsIterator | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | Apache-2.0 |
@Override
public boolean contains(Object collection, Object entity) {
return ( ( DefaultableList ) collection ).contains( entity );
} | Our Hibernate type-system extension for defining our specialized collection
contract.
@author Holger Brands
@author Steve Ebersole | contains | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | Apache-2.0 |
@Override
public Object indexOf(Object collection, Object entity) {
int index = ( ( DefaultableList ) collection ).indexOf( entity );
return index >= 0 ? new Integer( index ) : null;
} | Our Hibernate type-system extension for defining our specialized collection
contract.
@author Holger Brands
@author Steve Ebersole | indexOf | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | Apache-2.0 |
@Override
public Object replaceElements(
Object original,
Object target,
CollectionPersister persister,
Object owner,
Map copyCache,
SharedSessionContractImplementor session) {
DefaultableList result = ( DefaultableList ) target;
result.clear();
result.addAll( ( DefaultableList ) original );
... | Our Hibernate type-system extension for defining our specialized collection
contract.
@author Holger Brands
@author Steve Ebersole | replaceElements | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | Apache-2.0 |
@Override
public void setParameterValues(Properties parameters) {
defaultValue = parameters.getProperty( "default" );
} | Our Hibernate type-system extension for defining our specialized collection
contract.
@author Holger Brands
@author Steve Ebersole | setParameterValues | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/DefaultableListType.java | Apache-2.0 |
@Id
public String getName() {
return name;
} | Our test entity
@author Steve Ebersole | getName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/Entity.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/Entity.java | Apache-2.0 |
void setName(String name) {
this.name = name;
} | Our test entity
@author Steve Ebersole | setName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/Entity.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/Entity.java | Apache-2.0 |
@ElementCollection( targetClass = String.class, fetch = FetchType.EAGER )
@CollectionType(
type = DefaultableListType.class,
parameters = @Parameter(name = "default", value = "Hello" )
)
@CollectionTable(name = "ENTVALS", joinColumns = @JoinColumn( name = "ENT_ID" ))
@OrderColumn( name = "POS" )
@Column(name... | Our test entity
@author Steve Ebersole | getValues | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/Entity.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/Entity.java | Apache-2.0 |
public void setValues(List values) {
this.values = values;
} | Our test entity
@author Steve Ebersole | setValues | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/Entity.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/Entity.java | Apache-2.0 |
@SuppressWarnings( {"unchecked"})
@Test
public void testBasicOperation() {
Session s = openSession();
Transaction t = s.beginTransaction();
Entity entity = new Entity( "tester" );
entity.getValues().add( "value-1" );
s.persist( entity );
t.commit();
s.close();
s = openSession();
t = s.beginTransact... | Tes for parameterized user collection types.
@author Holger Brands
@author Steve Ebersole | testBasicOperation | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/ParameterizedUserCollectionTypeTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/ParameterizedUserCollectionTypeTest.java | Apache-2.0 |
public String getDefaultValue() {
return ( ( DefaultableList ) this.list ).getDefaultValue();
} | The "persistent wrapper" around our specialized collection contract
@author Holger Brands
@author Steve Ebersole | getDefaultValue | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/PersistentDefaultableList.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/parameterized/PersistentDefaultableList.java | Apache-2.0 |
public Integer getId() {
return id;
} | @author Gavin King
@author Steve Ebersole | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/registration/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/registration/User.java | Apache-2.0 |
public String getUserName() {
return userName;
} | @author Gavin King
@author Steve Ebersole | getUserName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/registration/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/registration/User.java | Apache-2.0 |
public void setUserName(String userName) {
this.userName = userName;
} | @author Gavin King
@author Steve Ebersole | setUserName | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/registration/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/registration/User.java | Apache-2.0 |
public List<Email> getEmailAddresses() {
return emailAddresses;
} | @author Gavin King
@author Steve Ebersole | getEmailAddresses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/registration/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/registration/User.java | Apache-2.0 |
public void setEmailAddresses(IMyList<Email> emailAddresses) {
this.emailAddresses = emailAddresses;
} | @author Gavin King
@author Steve Ebersole | setEmailAddresses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/registration/User.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/registration/User.java | Apache-2.0 |
@BeforeEach
public void prepareTestData(SessionFactoryScope scope) {
scope.inTransaction( (session) -> {
Person person = new Person( 1 );
person.phones.add( "027-123-4567" );
person.phones.add( "028-234-9876" );
session.persist( person );
} );
} | Used in the User Guide
@author Steve Ebersole | prepareTestData | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/nature/elemental/ElementalBagTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/nature/elemental/ElementalBagTest.java | Apache-2.0 |
@AfterEach
public void dropTestData(SessionFactoryScope scope) {
scope.inTransaction( (session) -> {
session.createQuery( "delete Person" ).executeUpdate();
} );
} | Used in the User Guide
@author Steve Ebersole | dropTestData | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/nature/elemental/ElementalBagTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/nature/elemental/ElementalBagTest.java | Apache-2.0 |
@Test
public void testLifecycle(SessionFactoryScope scope) {
scope.inTransaction( (entityManager) -> {
Person person = entityManager.find( Person.class, 1 );
//tag::ex-collection-elemental-lifecycle[]
// Clear element collection and add element
person.getPhones().clear();
person.getPhones().add( "123-... | Used in the User Guide
@author Steve Ebersole | testLifecycle | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/nature/elemental/ElementalBagTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/nature/elemental/ElementalBagTest.java | Apache-2.0 |
public Collection<String> getPhones() {
return phones;
} | Used in the User Guide
@author Steve Ebersole | getPhones | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/nature/elemental/ElementalBagTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/nature/elemental/ElementalBagTest.java | Apache-2.0 |
@Override
public boolean add(E element) {
if ( element == null ) {
// per java.util.List requirements
throw new NullPointerException( "Passed collection cannot be null" );
}
final Boolean exists = isOperationQueueEnabled() ? readElementExistence( element ) : null;
if ( exists == null ) {
initialize( ... | todo (6.0) : much of this is copy-paste from PersistentList
this is true for most attempts at a custom PersistentCollection;
we need to clean these up so it is easier to provide custom
implementations | add | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | Apache-2.0 |
@Override
public boolean addAll(Collection<? extends E> values) {
if ( values == null ) {
// per java.util.List requirements
throw new NullPointerException( "Passed collection cannot be null" );
}
boolean changed = false;
for ( E value : values ) {
final boolean added = add( value );
if ( ! added )... | todo (6.0) : much of this is copy-paste from PersistentList
this is true for most attempts at a custom PersistentCollection;
we need to clean these up so it is easier to provide custom
implementations | addAll | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | Apache-2.0 |
@Override
public boolean addAll(int index, Collection<? extends E> values) {
if ( values == null ) {
// per java.util.List requirements
throw new NullPointerException( "Passed collection cannot be null" );
}
return addAllStartingAt( index, values );
} | todo (6.0) : much of this is copy-paste from PersistentList
this is true for most attempts at a custom PersistentCollection;
we need to clean these up so it is easier to provide custom
implementations | addAll | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | Apache-2.0 |
private boolean addAllStartingAt(int index, Collection<? extends E> values) {
if ( values == null ) {
// per java.util.List requirements
throw new NullPointerException( "Passed collection cannot be null" );
}
boolean changed = false;
int position = index;
for ( E value : values ) {
final boolean add... | todo (6.0) : much of this is copy-paste from PersistentList
this is true for most attempts at a custom PersistentCollection;
we need to clean these up so it is easier to provide custom
implementations | addAllStartingAt | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | Apache-2.0 |
private boolean addAt(int index, E value) {
if ( value == null ) {
// per java.util.List requirements
throw new NullPointerException( "Passed collection cannot be null" );
}
final Boolean exists = isOperationQueueEnabled() ? readElementExistence( value ) : null;
if ( exists == null ) {
initialize( tru... | todo (6.0) : much of this is copy-paste from PersistentList
this is true for most attempts at a custom PersistentCollection;
we need to clean these up so it is easier to provide custom
implementations | addAt | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.