HHH-9807 - Better error message when @Formula and @Id are combined
This commit is contained in:
parent
1a0bbe19cc
commit
6d590d76b6
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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.test.annotations.id;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import org.hibernate.annotations.Formula;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Originally developed for HHH-9807 - better error message on combination of {@code @Id} + {@code @Formula}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class AndFormulaTest extends BaseUnitTestCase {
|
||||
private static StandardServiceRegistry ssr;
|
||||
|
||||
@BeforeClass
|
||||
public static void prepareServiceRegistry() {
|
||||
ssr = new StandardServiceRegistryBuilder().build();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void releaseServiceRegistry() {
|
||||
if ( ssr != null ) {
|
||||
StandardServiceRegistryBuilder.destroy( ssr );
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( jiraKey = "HHH-9807" )
|
||||
public void testBindingEntityWithIdAndFormula() {
|
||||
new MetadataSources( ssr )
|
||||
.addAnnotatedClass( EntityWithIdAndFormula.class )
|
||||
.buildMetadata();
|
||||
}
|
||||
|
||||
@Entity
|
||||
public static class EntityWithIdAndFormula {
|
||||
@Id
|
||||
@Formula( value = "VALUE" )
|
||||
public Integer id;
|
||||
}
|
||||
}
|
|
@ -54,7 +54,7 @@ class FailureExpectedHandler extends Statement {
|
|||
|
||||
// handle the expected failure case
|
||||
log.infof(
|
||||
"Ignoring expected failure [{}] : {}",
|
||||
"Ignoring expected failure [%s] : %s",
|
||||
Helper.extractTestName( extendedFrameworkMethod ),
|
||||
Helper.extractMessage( failureExpected )
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue