Search in sources :

Example 1 with JaxbHbmSynchronizeType

use of org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSynchronizeType in project hibernate-orm by hibernate.

the class AbstractPluralAttributeSourceImpl method extractSynchronizedTableNames.

private static String[] extractSynchronizedTableNames(PluralAttributeInfo pluralAttributeElement) {
    if (pluralAttributeElement.getSynchronize().isEmpty()) {
        return new String[0];
    }
    final String[] names = new String[pluralAttributeElement.getSynchronize().size()];
    int i = 0;
    for (JaxbHbmSynchronizeType jaxbHbmSynchronizeType : pluralAttributeElement.getSynchronize()) {
        names[i++] = jaxbHbmSynchronizeType.getTable();
    }
    return names;
}
Also used : JaxbHbmSynchronizeType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSynchronizeType)

Example 2 with JaxbHbmSynchronizeType

use of org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSynchronizeType in project hibernate-orm by hibernate.

the class NamedQueryBinder method processNamedQueryContentItem.

private static boolean processNamedQueryContentItem(Object content, NamedSQLQueryDefinitionBuilder builder, ImplicitResultSetMappingDefinition.Builder implicitResultSetMappingBuilder, JaxbHbmNamedNativeQueryType namedQueryBinding, HbmLocalMetadataBuildingContext context) {
    if (String.class.isInstance(content)) {
        // Especially when the query string is wrapped in CDATA we will get
        // "extra" Strings here containing just spaces and/or newlines.  This
        // bit tries to account for them.
        final String contentString = StringHelper.nullIfEmpty(((String) content).trim());
        if (contentString != null) {
            builder.setQuery((String) content);
            return true;
        } else {
            return false;
        }
    } else if (JAXBElement.class.isInstance(content)) {
        return processNamedQueryContentItem(((JAXBElement) content).getValue(), builder, implicitResultSetMappingBuilder, namedQueryBinding, context);
    }
    if (JaxbHbmQueryParamType.class.isInstance(content)) {
        final JaxbHbmQueryParamType paramTypeBinding = (JaxbHbmQueryParamType) content;
        builder.addParameterType(paramTypeBinding.getName(), paramTypeBinding.getType());
    } else if (JaxbHbmSynchronizeType.class.isInstance(content)) {
        final JaxbHbmSynchronizeType synchronizedSpace = (JaxbHbmSynchronizeType) content;
        builder.addSynchronizedQuerySpace(synchronizedSpace.getTable());
    } else if (JaxbHbmNativeQueryScalarReturnType.class.isInstance(content)) {
        implicitResultSetMappingBuilder.addReturn((JaxbHbmNativeQueryScalarReturnType) content);
    } else if (JaxbHbmNativeQueryReturnType.class.isInstance(content)) {
        implicitResultSetMappingBuilder.addReturn((JaxbHbmNativeQueryReturnType) content);
    } else if (JaxbHbmNativeQueryJoinReturnType.class.isInstance(content)) {
        implicitResultSetMappingBuilder.addReturn((JaxbHbmNativeQueryJoinReturnType) content);
    } else if (JaxbHbmNativeQueryCollectionLoadReturnType.class.isInstance(content)) {
        implicitResultSetMappingBuilder.addReturn((JaxbHbmNativeQueryCollectionLoadReturnType) content);
    } else {
        throw new org.hibernate.boot.MappingException(String.format(Locale.ENGLISH, "Encountered unexpected content type [%s] for named native query [%s] : [%s]", content.getClass().getName(), namedQueryBinding.getName(), content.toString()), context.getOrigin());
    }
    return false;
}
Also used : JaxbHbmQueryParamType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmQueryParamType) JaxbHbmNativeQueryCollectionLoadReturnType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryCollectionLoadReturnType) JAXBElement(javax.xml.bind.JAXBElement) JaxbHbmSynchronizeType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSynchronizeType) JaxbHbmNativeQueryReturnType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryReturnType)

Aggregations

JaxbHbmSynchronizeType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSynchronizeType)2 JAXBElement (javax.xml.bind.JAXBElement)1 JaxbHbmNativeQueryCollectionLoadReturnType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryCollectionLoadReturnType)1 JaxbHbmNativeQueryReturnType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryReturnType)1 JaxbHbmQueryParamType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmQueryParamType)1