private static NativeSQLQueryJoinReturn bindReturnJoin(Element returnElem, Mappings mappings) { String alias = returnElem.attributeValue( "alias" ); String roleAttribute = returnElem.attributeValue( "property" ); LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) ); int dot = roleAttribute.lastIndexOf( '.' ); if ( dot == -1 ) { throw new MappingException( "Role attribute for sql query return [alias=" + alias + "] not formatted correctly {owningAlias.propertyName}" ); } String roleOwnerAlias = roleAttribute.substring( 0, dot ); String roleProperty = roleAttribute.substring( dot + 1 ); //FIXME: get the PersistentClass java.util.Map propertyResults = bindPropertyResults(alias, returnElem, null, mappings ); return new NativeSQLQueryJoinReturn( alias, roleOwnerAlias, roleProperty, propertyResults, // TODO: bindpropertyresults(alias, returnElem) lockMode ); }
private static ArrayList getResultColumns(Element propertyresult) { String column = unquote(propertyresult.attributeValue("column")); ArrayList allResultColumns = new ArrayList(); if(column!=null) allResultColumns.add(column); Iterator resultColumns = propertyresult.elementIterator("return-column"); while ( resultColumns.hasNext() ) { Element element = (Element) resultColumns.next(); allResultColumns.add( unquote(element.attributeValue("name")) ); } return allResultColumns; }
definition.addQueryReturn( bindReturn( returnElem, mappings, cnt ) ); definition.addQueryReturn( bindReturnJoin( returnElem, mappings ) ); definition.addQueryReturn( bindLoadCollection( returnElem, mappings ) );
ArrayList resultColumns = getResultColumns(discriminatorResult); propertyresults.put("class", ArrayHelper.toStringArray( resultColumns ) ); for (int loop = 0 ; loop < followersSize ; loop++) { String follower = (String) followers.get(loop); int currentIndex = getIndexOfFirstMatchingProperty(propertyNames, follower); index = currentIndex != -1 && currentIndex < index ? currentIndex : index; ArrayList allResultColumns = getResultColumns(propertyresult);
private static NativeSQLQueryRootReturn bindReturn(Element returnElem, Mappings mappings, int elementCount) { String alias = returnElem.attributeValue( "alias" ); if( StringHelper.isEmpty(alias)) { alias = "alias_" + elementCount; // hack/workaround as sqlquery impl depend on having a key. } String entityName = HbmBinder.getEntityName(returnElem, mappings); if(entityName==null) { throw new MappingException( "<return alias='" + alias + "'> must specify either a class or entity-name"); } LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) ); PersistentClass pc = mappings.getClass( entityName ); java.util.Map propertyResults = bindPropertyResults(alias, returnElem, pc, mappings ); return new NativeSQLQueryRootReturn( alias, entityName, propertyResults, lockMode ); }
for (int loop = 0 ; loop < followersSize ; loop++) { String follower = (String) followers.get(loop); int currentIndex = getIndexOfFirstMatchingProperty(propertyNames, follower); index = currentIndex != -1 && currentIndex < index ? currentIndex : index;
definition.addQueryReturn( bindReturn( returnElem, mappings, cnt ) ); definition.addQueryReturn( bindReturnJoin( returnElem, mappings ) ); definition.addQueryReturn( bindLoadCollection( returnElem, mappings ) );
ArrayList resultColumns = getResultColumns(discriminatorResult); propertyresults.put("class", ArrayHelper.toStringArray( resultColumns ) ); for (int loop = 0 ; loop < followersSize ; loop++) { String follower = (String) followers.get(loop); int currentIndex = getIndexOfFirstMatchingProperty(propertyNames, follower); index = currentIndex != -1 && currentIndex < index ? currentIndex : index; ArrayList allResultColumns = getResultColumns(propertyresult);
definition.addQueryReturn( bindReturn( returnElem, mappings, cnt ) ); definition.addQueryReturn( bindReturnJoin( returnElem, mappings ) ); definition.addQueryReturn( bindLoadCollection( returnElem, mappings ) );
private static NativeSQLQueryJoinReturn bindReturnJoin(Element returnElem, Mappings mappings) { String alias = returnElem.attributeValue( "alias" ); String roleAttribute = returnElem.attributeValue( "property" ); LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) ); int dot = roleAttribute.lastIndexOf( '.' ); if ( dot == -1 ) { throw new MappingException( "Role attribute for sql query return [alias=" + alias + "] not formatted correctly {owningAlias.propertyName}" ); } String roleOwnerAlias = roleAttribute.substring( 0, dot ); String roleProperty = roleAttribute.substring( dot + 1 ); //FIXME: get the PersistentClass java.util.Map propertyResults = bindPropertyResults(alias, returnElem, null, mappings ); return new NativeSQLQueryJoinReturn( alias, roleOwnerAlias, roleProperty, propertyResults, // TODO: bindpropertyresults(alias, returnElem) lockMode ); }
private static ArrayList getResultColumns(Element propertyresult) { String column = unquote(propertyresult.attributeValue("column")); ArrayList allResultColumns = new ArrayList(); if(column!=null) allResultColumns.add(column); Iterator resultColumns = propertyresult.elementIterator("return-column"); while ( resultColumns.hasNext() ) { Element element = (Element) resultColumns.next(); allResultColumns.add( unquote(element.attributeValue("name")) ); } return allResultColumns; }
private static NativeSQLQueryCollectionReturn bindLoadCollection(Element returnElem, Mappings mappings) { String alias = returnElem.attributeValue( "alias" ); String collectionAttribute = returnElem.attributeValue( "role" ); LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) ); int dot = collectionAttribute.lastIndexOf( '.' ); if ( dot == -1 ) { throw new MappingException( "Collection attribute for sql query return [alias=" + alias + "] not formatted correctly {OwnerClassName.propertyName}" ); } String ownerClassName = HbmBinder.getClassName( collectionAttribute.substring( 0, dot ), mappings ); String ownerPropertyName = collectionAttribute.substring( dot + 1 ); //FIXME: get the PersistentClass java.util.Map propertyResults = bindPropertyResults(alias, returnElem, null, mappings ); return new NativeSQLQueryCollectionReturn( alias, ownerClassName, ownerPropertyName, propertyResults, lockMode ); }
private static ArrayList getResultColumns(Element propertyresult) { String column = unquote(propertyresult.attributeValue("column")); ArrayList allResultColumns = new ArrayList(); if(column!=null) allResultColumns.add(column); Iterator resultColumns = propertyresult.elementIterator("return-column"); while ( resultColumns.hasNext() ) { Element element = (Element) resultColumns.next(); allResultColumns.add( unquote(element.attributeValue("name")) ); } return allResultColumns; }
private static NativeSQLQueryCollectionReturn bindLoadCollection(Element returnElem, Mappings mappings) { String alias = returnElem.attributeValue( "alias" ); String collectionAttribute = returnElem.attributeValue( "role" ); LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) ); int dot = collectionAttribute.lastIndexOf( '.' ); if ( dot == -1 ) { throw new MappingException( "Collection attribute for sql query return [alias=" + alias + "] not formatted correctly {OwnerClassName.propertyName}" ); } String ownerClassName = HbmBinder.getClassName( collectionAttribute.substring( 0, dot ), mappings ); String ownerPropertyName = collectionAttribute.substring( dot + 1 ); //FIXME: get the PersistentClass java.util.Map propertyResults = bindPropertyResults(alias, returnElem, null, mappings ); return new NativeSQLQueryCollectionReturn( alias, ownerClassName, ownerPropertyName, propertyResults, lockMode ); }
private static NativeSQLQueryRootReturn bindReturn(Element returnElem, Mappings mappings, int elementCount) { String alias = returnElem.attributeValue( "alias" ); if( StringHelper.isEmpty( alias )) { alias = "alias_" + elementCount; // hack/workaround as sqlquery impl depend on having a key. } String entityName = HbmBinder.getEntityName(returnElem, mappings); if(entityName==null) { throw new MappingException( "<return alias='" + alias + "'> must specify either a class or entity-name"); } LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) ); PersistentClass pc = mappings.getClass( entityName ); java.util.Map propertyResults = bindPropertyResults(alias, returnElem, pc, mappings ); return new NativeSQLQueryRootReturn( alias, entityName, propertyResults, lockMode ); }
private static NativeSQLQueryRootReturn bindReturn(Element returnElem, Mappings mappings, int elementCount) { String alias = returnElem.attributeValue( "alias" ); if( StringHelper.isEmpty( alias )) { alias = "alias_" + elementCount; // hack/workaround as sqlquery impl depend on having a key. } String entityName = HbmBinder.getEntityName(returnElem, mappings); if(entityName==null) { throw new MappingException( "<return alias='" + alias + "'> must specify either a class or entity-name"); } LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) ); PersistentClass pc = mappings.getClass( entityName ); java.util.Map propertyResults = bindPropertyResults(alias, returnElem, pc, mappings ); return new NativeSQLQueryRootReturn( alias, entityName, propertyResults, lockMode ); }