public void setDiscriminator(Discriminator owner) { disc = owner; ClassMapping cls = disc.getClassMapping(); isFinal = Modifier.isFinal(cls.getDescribedType().getModifiers()); }
public Class getType() { if (_exps != null && _type == null) { if (_exps.projections.length == 0) return _candidate.getDescribedType(); if (_exps.projections.length == 1) return _exps.projections[0].getType(); } return _type; }
/** * Return whether the given name matches the given mapping. */ private static boolean isClassMappingName(String name, ClassMapping cls) { if (cls == null) return false; if (name.equals(cls.getDescribedType().getName()) || name.equals(ClassUtil.getClassName(cls.getDescribedType()))) return true; return isClassMappingName(name, cls.getPCSuperclassMapping()); }
private FinderQuery<ClassMapping, SelectExecutor, Result> markUncachable(ClassMapping mapping, String reason) { lock(); try { String cls = mapping.getDescribedType().getName(); boolean excludedByUser = _uncachables.get(cls) == EXLUDED_BY_USER; if (!excludedByUser) _uncachables.put(cls, reason); return _delegate.remove(mapping); } finally { unlock(); } }
public String getTableName(ClassMapping cls, Schema schema) { String name = ClassUtil.getClassName(cls.getDescribedType()). replace(IdentifierUtil.DOLLAR_CHAR, IdentifierUtil.UNDERSCORE_CHAR); if (!_defMissing) name = dict.getValidTableName(name, schema); return name; }
public String getTableName(ClassMapping cls, Schema schema) { String name = Strings.getClassName(cls.getDescribedType()). replace(IdentifierUtil.DOLLAR_CHAR, IdentifierUtil.UNDERSCORE_CHAR); if (!_defMissing) name = dict.getValidTableName(name, schema); return name; }
/** * Set the given class' objectid-class. */ private void setObjectIdType(ClassMapping cls) { String name = cls.getDescribedType().getName(); if (_inner) name += "$"; name += _idSuffix; cls.setObjectIdType(generateClass(name, null), false); }
private boolean useDiscrimColumn(ClassMapping base, Result res) throws SQLException { if (res.getBaseMapping() != null && base != null) { // check whether the result type is assignable to the base mapping. // if not assignable the discriminator value will not be correct. if (!base.getDescribedType().isAssignableFrom(res.getBaseMapping().getDescribedType())) { return false; } } return res.contains(disc.getColumns()[0]); }
private boolean useDiscrimColumn(ClassMapping base, Result res) throws SQLException { if (res.getBaseMapping() != null && base != null) { // check whether the result type is assignable to the base mapping. // if not assignable the discriminator value will not be correct. if (!base.getDescribedType().isAssignableFrom(res.getBaseMapping().getDescribedType())) { return false; } } return res.contains(disc.getColumns()[0]); }
private final boolean useDiscrimColumn(ClassMapping base, Result res) throws SQLException { if (res.getBaseMapping() != null && base != null) { // check whether the result type is assignable to the base mapping. // if not assignable the discriminator value will not be correct. if (!base.getDescribedType().isAssignableFrom(res.getBaseMapping().getDescribedType())) { return false; } } return res.contains(disc.getColumns()[0]); }
/** * Return whether the given class has any mapped persistent subclasses. */ private boolean hasSubclasses(ClassMapping cls) { ClassMetaData[] metas = repos.getMetaDatas(); for (int i = 0; i < metas.length; i++) if (metas[i].getPCSuperclass() == cls.getDescribedType()) return true; return false; } }
@Override public String getTableName(ClassMapping cls, Schema schema) { if (cls.getTypeAlias() != null) return cls.getTypeAlias(); return ClassUtil.getClassName(cls.getDescribedType()).replace('$', '_'); }
@Override public String getTableName(ClassMapping cls, Schema schema) { if (cls.getTypeAlias() != null) return cls.getTypeAlias(); return ClassUtil.getClassName(cls.getDescribedType()).replace('$', '_'); }
private String getKey(ClassMapping mapping, boolean db) { if (_ignore) { while (mapping.getMappedPCSuperclassMapping() != null) mapping = mapping.getMappedPCSuperclassMapping(); } else { while (mapping.getPCSuperclass() != null) mapping = mapping.getPCSuperclassMapping(); } if (_aliases) return mapping.getTypeAlias(); return mapping.getDescribedType().getName(); }
public void map(boolean adapt) { Object val = disc.getMappingInfo().getValue(disc, adapt); if (val == null && !Modifier.isAbstract(disc.getClassMapping(). getDescribedType().getModifiers())) throw new MetaDataException(_loc.get("no-discrim-value", disc.getClassMapping())); // we set the value before mapping to use to calculate the template // column's java type disc.setValue(val); super.map(adapt); } }
/** * Return the class loader to use for loading class names. */ private ClassLoader getClassLoader(JDBCStore store) { return store.getConfiguration().getClassResolverInstance(). getClassLoader(disc.getClassMapping().getDescribedType(), store.getContext().getClassLoader()); } }
/** * Return the class loader to use for loading class names. */ private ClassLoader getClassLoader(JDBCStore store) { return store.getConfiguration().getClassResolverInstance(). getClassLoader(disc.getClassMapping().getDescribedType(), store.getContext().getClassLoader()); } }
/** * Return the class loader to use for loading class names. */ private ClassLoader getClassLoader(JDBCStore store) { return store.getConfiguration().getClassResolverInstance(). getClassLoader(disc.getClassMapping().getDescribedType(), store.getContext().getClassLoader()); } }
public Class getClass(JDBCStore store, ClassMapping base, Result res) throws SQLException, ClassNotFoundException { if (isFinal || !useDiscrimColumn(base, res) || (base.getPCSuperclass() == null && base.getJoinablePCSubclassMappings().length == 0)) { return base.getDescribedType(); } Object cls = res.getObject(disc.getColumns()[0], disc.getJavaType(), null); return getClass(cls, store); }
public void map(boolean adapt) { ValueMapping vm = cls.getEmbeddingMapping(); if (vm == null || vm.getType() != cls.getDescribedType() || vm.getTypeCode() != JavaTypes.OID) throw new MetaDataException(_loc.get("not-oid", cls)); ClassMappingInfo info = cls.getMappingInfo(); info.assertNoSchemaComponents(cls, true); cls.setTable(vm.getFieldMapping().getTable()); } }