HHH-7919 : xsd mapping was not generacted correctly, which was forcing the order of elements which doesn't required by the old dtd

This commit is contained in:
Strong Liu 2013-05-28 15:02:56 -07:00
parent 09f7469ac6
commit 048fd36530
8 changed files with 42 additions and 35 deletions

View File

@ -124,7 +124,7 @@ public class InvalidMappingException extends MappingException {
* @param origin The origin of the invalid mapping document
* @param cause The underlying cause
*/
public InvalidMappingException(String customMessage, Origin origin, Exception cause) {
public InvalidMappingException(String customMessage, Origin origin, Throwable cause) {
this( customMessage, origin.getType().name(), origin.getName(), cause );
}

View File

@ -255,7 +255,7 @@ public class MetadataSources {
return jaxbRoot;
}
catch ( Exception e ) {
throw new InvalidMappingException( origin );
throw new InvalidMappingException( origin, e );
}
finally {
if ( close ) {

View File

@ -43,6 +43,15 @@ public class InvalidMappingException extends org.hibernate.InvalidMappingExcepti
this.origin = origin;
}
public InvalidMappingException(Origin origin, Throwable e) {
super(
String.format( "Could not parse mapping document: %s (%s)", origin.getName(), origin.getType() ),
origin,
e
);
this.origin = origin;
}
public Origin getOrigin() {
return origin;
}

View File

@ -23,37 +23,40 @@ arbitrary number of queries, and import declarations of arbitrary classes.
-->
<xs:element name="hibernate-mapping">
<xs:complexType>
<xs:sequence>
<xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<simplify:as-element-property/>
</xs:appinfo>
</xs:annotation>
<xs:element name="meta" type="meta-element"/>
<!-- <identifier-generator.../> allows customized short-naming of IdentifierGenerator implementations. -->
<xs:element name="identifier-generator"
minOccurs="0"
maxOccurs="unbounded"
type="identifier-generator-element"/>
<!--
<typedef.../> allows defining a customized type mapping for a Hibernate type. May
contain parameters for parameterizable types.
-->
<xs:element name="typedef" minOccurs="0" maxOccurs="unbounded" type="typedef-element"/>
<xs:element name="typedef" type="typedef-element"/>
<!--
FILTER-DEF element; top-level filter definition.
-->
<xs:element name="filter-def" minOccurs="0" maxOccurs="unbounded" type="filter-def-element"/>
<xs:element name="filter-def" type="filter-def-element"/>
<!--
IMPORT element definition; an explicit query language "import"
-->
<xs:element name="import" minOccurs="0" maxOccurs="unbounded" type="import-element"/>
<xs:element name="import" type="import-element"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<simplify:as-element-property/>
</xs:appinfo>
</xs:annotation>
<!--<xs:choice minOccurs="0" maxOccurs="unbounded">-->
<!--<xs:annotation>-->
<!--<xs:appinfo>-->
<!--<simplify:as-element-property/>-->
<!--</xs:appinfo>-->
<!--</xs:annotation>-->
<!--
Root entity mapping. Poorly named as entities do not have to be represented by
classes at all. Mapped entities may be represented via different methodologies
@ -63,18 +66,19 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:element name="subclass" type="subclass-element"/>
<xs:element name="joined-subclass" type="joined-subclass-element"/>
<xs:element name="union-subclass" type="union-subclass-element"/>
</xs:choice>
<!--</xs:choice>-->
<xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<simplify:as-element-property/>
</xs:appinfo>
</xs:annotation>
<xs:group ref="query-or-sql-query"/>
</xs:choice>
<xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
<xs:element name="resultset" type="resultset-element"/>
<!--<xs:choice minOccurs="0" maxOccurs="unbounded">-->
<!--<xs:annotation>-->
<!--<xs:appinfo>-->
<!--<simplify:as-element-property/>-->
<!--</xs:appinfo>-->
<!--</xs:annotation>-->
<!--<xs:group ref="query-or-sql-query"/>-->
<!--</xs:choice>-->
<xs:group ref="query-or-sql-query"/>
<xs:element name="fetch-profile" type="fetch-profile-element"/>
<!--
Element for defining "auxiliary" database objects. Must be one of two forms:
@ -88,8 +92,8 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<drop>DROP ....</drop>
</database-object>
-->
<xs:element name="database-object" minOccurs="0" maxOccurs="unbounded" type="database-object-element"/>
</xs:sequence>
<xs:element name="database-object" type="database-object-element"/>
</xs:choice>
<xs:attribute name="auto-import" default="true" type="xs:boolean"/>
<xs:attribute name="catalog" type="xs:string"/>

View File

@ -32,7 +32,6 @@ import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -40,7 +39,6 @@ import static org.junit.Assert.assertEquals;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewMetamodel
public class DiscrimSubclassFilterTest extends BaseCoreFunctionalTestCase {
@Override
public final String[] getMappings() {

View File

@ -33,7 +33,6 @@ import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.dialect.CUBRIDDialect;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -42,7 +41,6 @@ import static org.junit.Assert.assertEquals;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewMetamodel
@SkipForDialect(
value = CUBRIDDialect.class,
comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" +

View File

@ -32,7 +32,6 @@ import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -40,7 +39,6 @@ import static org.junit.Assert.assertEquals;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewMetamodel
public class UnionSubclassFilterTest extends BaseCoreFunctionalTestCase {
@Override
public final String[] getMappings() {

View File

@ -8,7 +8,7 @@
<class name="Person" table="UPerson">
<id name="id" column="person_id">
<generator class="hilo"/>
<generator class="seqhilo"/>
</id>
<property name="name" unique="true" not-null="true"/>