-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-17448 - Add newly standard column annotation attributes to Hibern…
…ate column annotations
- Loading branch information
Showing
5 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...ate-core/src/test/java/org/hibernate/orm/test/softdelete/SoftDeleteColumnConfigTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | ||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html. | ||
*/ | ||
package org.hibernate.orm.test.softdelete; | ||
|
||
import org.hibernate.annotations.SoftDelete; | ||
import org.hibernate.mapping.Column; | ||
import org.hibernate.mapping.PersistentClass; | ||
import org.hibernate.mapping.RootClass; | ||
|
||
import org.hibernate.testing.orm.junit.DomainModel; | ||
import org.hibernate.testing.orm.junit.DomainModelScope; | ||
import org.hibernate.testing.schema.SchemaCreateHelper; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* @author Steve Ebersole | ||
*/ | ||
@SuppressWarnings("JUnitMalformedDeclaration") | ||
public class SoftDeleteColumnConfigTests { | ||
@Test | ||
@DomainModel(annotatedClasses = Thing.class) | ||
void verifyModel(DomainModelScope modelScope) { | ||
final RootClass entityBinding = (RootClass) modelScope.getEntityBinding( Thing.class ); | ||
final Column softDeleteColumn = entityBinding.getSoftDeleteColumn(); | ||
assertThat( softDeleteColumn.getOptions() ).isEqualTo( "do_it=true" ); | ||
assertThat( softDeleteColumn.getComment() ).isEqualTo( "Explicit soft-delete comment" ); | ||
|
||
final String ddl = SchemaCreateHelper.toCreateDdl( modelScope.getDomainModel() ); | ||
assertThat( ddl ).contains( "do_it=true" ); | ||
assertThat( ddl ).contains( "Explicit soft-delete comment" ); | ||
} | ||
|
||
@Entity(name="Thing") | ||
@Table(name="Thing") | ||
@SoftDelete( comment = "Explicit soft-delete comment", options = "do_it=true" ) | ||
public static class Thing { | ||
@Id | ||
private Integer id; | ||
private String name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters