本文整理汇总了Java中org.apache.ojb.broker.PersistenceBroker.getTopLevelClass方法的典型用法代码示例。如果您正苦于以下问题:Java PersistenceBroker.getTopLevelClass方法的具体用法?Java PersistenceBroker.getTopLevelClass怎么用?Java PersistenceBroker.getTopLevelClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ojb.broker.PersistenceBroker
的用法示例。
在下文中一共展示了PersistenceBroker.getTopLevelClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getElementsExtentClass
import org.apache.ojb.broker.PersistenceBroker; //导入方法依赖的package包/类
private Class getElementsExtentClass(PersistenceBroker broker) throws PersistenceBrokerException
{
// we ll have to compute the most general extent class here !!!
DListEntry entry = (DListEntry) elements.get(0);
Class elementsClass = entry.getRealSubject().getClass();
Class extentClass = broker.getTopLevelClass(elementsClass);
return extentClass;
}
示例2: getElementsExtentClass
import org.apache.ojb.broker.PersistenceBroker; //导入方法依赖的package包/类
private Class getElementsExtentClass(PersistenceBroker brokerForClass) throws PersistenceBrokerException
{
// we ll have to compute the most general extent class here !!!
DListEntry entry = (DListEntry) elements.get(0);
Class elementsClass = entry.getRealSubject().getClass();
Class extentClass = brokerForClass.getTopLevelClass(elementsClass);
return extentClass;
}
示例3: associateBatched
import org.apache.ojb.broker.PersistenceBroker; //导入方法依赖的package包/类
/**
* Associate the batched Children with their owner object.
* Loop over owners
*/
protected void associateBatched(Collection owners, Collection children)
{
ObjectReferenceDescriptor ord = getObjectReferenceDescriptor();
ClassDescriptor cld = getOwnerClassDescriptor();
Object owner;
Object relatedObject;
Object fkValues[];
Identity id;
PersistenceBroker pb = getBroker();
PersistentField field = ord.getPersistentField();
Class topLevelClass = pb.getTopLevelClass(ord.getItemClass());
HashMap childrenMap = new HashMap(children.size());
for (Iterator it = children.iterator(); it.hasNext(); )
{
relatedObject = it.next();
childrenMap.put(pb.serviceIdentity().buildIdentity(relatedObject), relatedObject);
}
for (Iterator it = owners.iterator(); it.hasNext(); )
{
owner = it.next();
fkValues = ord.getForeignKeyValues(owner,cld);
if (isNull(fkValues))
{
field.set(owner, null);
continue;
}
id = pb.serviceIdentity().buildIdentity(null, topLevelClass, fkValues);
relatedObject = childrenMap.get(id);
field.set(owner, relatedObject);
}
}
示例4: getMaxForExtent
import org.apache.ojb.broker.PersistenceBroker; //导入方法依赖的package包/类
/**
* Lookup all tables associated with given class (search all extent classes)
* to find the current maximum value for the given field.
* <br><b>Note:</b> Only works for <code>long</code> autoincrement fields.
* @param brokerForClass persistence broker instance match the database of the
* given field/class
* @param field the target field
*/
public static long getMaxForExtent(PersistenceBroker brokerForClass, FieldDescriptor field) throws PersistenceBrokerException
{
if (field == null)
{
log.error("Given FieldDescriptor was null, could not detect max value across all extents");
return 0;
// throw new PersistenceBrokerException("Given FieldDescriptor was null");
}
// first lookup top-level class
Class topLevel = brokerForClass.getTopLevelClass(field.getClassDescriptor().getClassOfObject());
return getMaxId(brokerForClass, topLevel, field);
}