Here are the examples of the java api org.hibernate.mapping.PersistentClass taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
125 Examples
19
Source : SpringPhysicalNamingStrategyTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void tableNameShouldNotBeLowerCaseIfCaseSensitive() {
this.metadata = this.metadataSources.getMetadataBuilder().applyPhysicalNamingStrategy(new TestSpringPhysicalNamingStrategy()).build();
PersistentClreplaced binding = this.metadata.getEnreplacedyBinding(TelephoneNumber.clreplaced.getName());
replacedertThat(binding.getTable().getQuotedName()).isEqualTo("Telephone_Number");
}
19
Source : SpringPhysicalNamingStrategyTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void tableNameShouldBeLowercaseUnderscore() {
PersistentClreplaced binding = this.metadata.getEnreplacedyBinding(TelephoneNumber.clreplaced.getName());
replacedertThat(binding.getTable().getQuotedName()).isEqualTo("telephone_number");
}
19
Source : ProxyDefinitions.java
with Apache License 2.0
from quarkusio
with Apache License 2.0
from quarkusio
private static boolean needsProxyGeneration(PersistentClreplaced persistentClreplaced) {
// Only lazy enreplacedies need a proxy, and only clreplaced-mapped clreplaceded can be proxies (Envers!)
return persistentClreplaced.isLazy() && (persistentClreplaced.getMappedClreplaced() != null);
}
19
Source : InterfaceMetadataContributor.java
with Apache License 2.0
from lihangqi
with Apache License 2.0
from lihangqi
/**
* 是否需要新增的属性
*/
private boolean isNewProperty(PersistentClreplaced pclazz, PropertyDescriptor desc) {
for (PersistentClreplaced cl = pclazz; cl != null; cl = cl.getSuperclreplaced()) {
if (cl.hasProperty(desc.getName())) {
return false;
}
}
Method read = desc.getReadMethod();
Method write = desc.getWriteMethod();
if (read == null || write == null) {
return false;
}
if (!read.getDeclaringClreplaced().isInterface()) {
return false;
}
if (read.isAnnotationPresent(Transient.clreplaced)) {
return false;
}
return true;
}
19
Source : PojoEntityTuplizer.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
protected Instantiator buildInstantiator(EnreplacedyMetamodel enreplacedyMetamodel, PersistentClreplaced persistentClreplaced) {
if (optimizer == null) {
return new PojoEnreplacedyInstantiator(enreplacedyMetamodel, persistentClreplaced, null);
} else {
return new PojoEnreplacedyInstantiator(enreplacedyMetamodel, persistentClreplaced, optimizer.getInstantiationOptimizer());
}
}
19
Source : DynamicMapEntityTuplizer.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
protected Instantiator buildInstantiator(EnreplacedyMetamodel enreplacedyMetamodel, PersistentClreplaced mappingInfo) {
return new DynamicMapInstantiator(mappingInfo);
}
19
Source : StandardPersisterClassResolver.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
public Clreplaced<? extends EnreplacedyPersister> getEnreplacedyPersisterClreplaced(PersistentClreplaced metadata) {
// todo : make sure this is based on an attribute kept on the metamodel in the new code, not the concrete PersistentClreplaced impl found!
if (RootClreplaced.clreplaced.isInstance(metadata)) {
if (metadata.hreplacedubclreplacedes()) {
// If the clreplaced has children, we need to find of which kind
metadata = (PersistentClreplaced) metadata.getDirectSubclreplacedes().next();
} else {
return singleTableEnreplacedyPersister();
}
}
if (JoinedSubclreplaced.clreplaced.isInstance(metadata)) {
return joinedSubclreplacedEnreplacedyPersister();
} else if (UnionSubclreplaced.clreplaced.isInstance(metadata)) {
return unionSubclreplacedEnreplacedyPersister();
} else if (SingleTableSubclreplaced.clreplaced.isInstance(metadata)) {
return singleTableEnreplacedyPersister();
} else {
throw new UnknownPersisterException("Could not determine persister implementation for enreplacedy [" + metadata.getEnreplacedyName() + "]");
}
}
19
Source : JoinedSubclassEntityPersister.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
/**
* Essentially we are building a mapping that we can later use to determine whether a given "subclreplaced table"
* should be included in joins when JPA TREAT-AS is used.
*
* @param persistentClreplaced
* @param factory
* @return
*/
private String[][] buildSubclreplacedNamesBySubclreplacedTableMapping(PersistentClreplaced persistentClreplaced, SessionFactoryImplementor factory) {
// this value represents the number of subclreplacedes (and not the clreplaced itself)
final int numberOfSubclreplacedTables = subclreplacedTableNameClosure.length - coreTableSpan;
if (numberOfSubclreplacedTables == 0) {
return new String[0][];
}
final String[][] mapping = new String[numberOfSubclreplacedTables][];
processPersistentClreplacedHierarchy(persistentClreplaced, true, factory, mapping);
return mapping;
}
19
Source : AbstractPropertyMapping.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
private PersistentClreplaced getCommonPersistentClreplaced(PersistentClreplaced clazz1, PersistentClreplaced clazz2) {
while (clazz2 != null && clazz2.getMappedClreplaced() != null && clazz1.getMappedClreplaced() != null && !clazz2.getMappedClreplaced().isreplacedignableFrom(clazz1.getMappedClreplaced())) {
clazz2 = clazz2.getSuperclreplaced();
}
return clazz2;
}
19
Source : MetamodelImpl.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
private void primeSecondLevelCacheRegions(MetadataImplementor mappingMetadata) {
final Map<String, DomainDataRegionConfigImpl.Builder> regionConfigBuilders = new ConcurrentHashMap<>();
// todo : ultimately this code can be made more efficient when we have a better intrinsic understanding of the hierarchy as a whole
for (PersistentClreplaced bootEnreplacedyDescriptor : mappingMetadata.getEnreplacedyBindings()) {
final AccessType accessType = AccessType.fromExternalName(bootEnreplacedyDescriptor.getCacheConcurrencyStrategy());
if (accessType != null) {
if (bootEnreplacedyDescriptor.isCached()) {
regionConfigBuilders.computeIfAbsent(bootEnreplacedyDescriptor.getRootClreplaced().getCacheRegionName(), DomainDataRegionConfigImpl.Builder::new).addEnreplacedyConfig(bootEnreplacedyDescriptor, accessType);
}
if (RootClreplaced.clreplaced.isInstance(bootEnreplacedyDescriptor) && bootEnreplacedyDescriptor.hasNaturalId() && bootEnreplacedyDescriptor.getNaturalIdCacheRegionName() != null) {
regionConfigBuilders.computeIfAbsent(bootEnreplacedyDescriptor.getNaturalIdCacheRegionName(), DomainDataRegionConfigImpl.Builder::new).addNaturalIdConfig((RootClreplaced) bootEnreplacedyDescriptor, accessType);
}
}
}
for (Collection collection : mappingMetadata.getCollectionBindings()) {
final AccessType accessType = AccessType.fromExternalName(collection.getCacheConcurrencyStrategy());
if (accessType != null) {
regionConfigBuilders.computeIfAbsent(collection.getCacheRegionName(), DomainDataRegionConfigImpl.Builder::new).addCollectionConfig(collection, accessType);
}
}
final Set<DomainDataRegionConfig> regionConfigs;
if (regionConfigBuilders.isEmpty()) {
regionConfigs = Collections.emptySet();
} else {
regionConfigs = new HashSet<>();
for (DomainDataRegionConfigImpl.Builder builder : regionConfigBuilders.values()) {
regionConfigs.add(builder.build());
}
}
getSessionFactory().getCache().prime(regionConfigs);
}
19
Source : MetamodelImpl.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
// TODO remove / reduce @SW scope
@SuppressWarnings("unchecked")
private static MappedSuperclreplacedTypeImpl<?> buildMappedSuperclreplacedType(MappedSuperclreplaced mappedSuperclreplaced, MetadataContext context) {
final MappedSuperclreplaced superMappedSuperclreplaced = mappedSuperclreplaced.getSuperMappedSuperclreplaced();
AbstractIdentifiableType<?> superType = superMappedSuperclreplaced == null ? null : locateOrBuildMappedsuperclreplacedType(superMappedSuperclreplaced, context);
// no mappedSuperclreplaced, check for a super enreplacedy
if (superType == null) {
final PersistentClreplaced superPersistentClreplaced = mappedSuperclreplaced.getSuperPersistentClreplaced();
superType = superPersistentClreplaced == null ? null : locateOrBuildEnreplacedyType(superPersistentClreplaced, context);
}
final Clreplaced javaType = mappedSuperclreplaced.getMappedClreplaced();
MappedSuperclreplacedTypeImpl mappedSuperclreplacedType = new MappedSuperclreplacedTypeImpl(javaType, mappedSuperclreplaced, superType);
context.registerMappedSuperclreplacedType(mappedSuperclreplaced, mappedSuperclreplacedType);
return mappedSuperclreplacedType;
}
19
Source : MetamodelImpl.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
private static EnreplacedyTypeImpl<?> locateOrBuildEnreplacedyType(PersistentClreplaced persistentClreplaced, MetadataContext context) {
EnreplacedyTypeImpl<?> enreplacedyType = context.locateEnreplacedyType(persistentClreplaced);
if (enreplacedyType == null) {
enreplacedyType = buildEnreplacedyType(persistentClreplaced, context);
}
return enreplacedyType;
}
19
Source : MetamodelImpl.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
// TODO remove / reduce @SW scope
@SuppressWarnings("unchecked")
private static EnreplacedyTypeImpl<?> buildEnreplacedyType(PersistentClreplaced persistentClreplaced, MetadataContext context) {
final Clreplaced javaType = persistentClreplaced.getMappedClreplaced();
context.pushEnreplacedyWorkedOn(persistentClreplaced);
final MappedSuperclreplaced superMappedSuperclreplaced = persistentClreplaced.getSuperMappedSuperclreplaced();
AbstractIdentifiableType<?> superType = superMappedSuperclreplaced == null ? null : locateOrBuildMappedsuperclreplacedType(superMappedSuperclreplaced, context);
// no mappedSuperclreplaced, check for a super enreplacedy
if (superType == null) {
final PersistentClreplaced superPersistentClreplaced = persistentClreplaced.getSuperclreplaced();
superType = superPersistentClreplaced == null ? null : locateOrBuildEnreplacedyType(superPersistentClreplaced, context);
}
EnreplacedyTypeImpl enreplacedyType = new EnreplacedyTypeImpl(javaType, superType, persistentClreplaced);
context.registerEnreplacedyType(persistentClreplaced, enreplacedyType);
context.popEnreplacedyWorkedOn(persistentClreplaced);
return enreplacedyType;
}
19
Source : MetadataContext.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
public void pushEnreplacedyWorkedOn(PersistentClreplaced persistentClreplaced) {
stackOfPersistentClreplacedesBeingProcessed.add(persistentClreplaced);
}
19
Source : MetadataContext.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
/**
* Given a Hibernate {@link PersistentClreplaced}, locate the corresponding JPA {@link org.hibernate.type.EnreplacedyType}
* implementation. May retur null if the given {@link PersistentClreplaced} has not yet been processed.
*
* @param persistentClreplaced The Hibernate (config time) metamodel instance representing an enreplacedy.
*
* @return Tne corresponding JPA {@link org.hibernate.type.EnreplacedyType}, or null if not yet processed.
*/
public EnreplacedyTypeImpl<?> locateEnreplacedyType(PersistentClreplaced persistentClreplaced) {
return enreplacedyTypesByPersistentClreplaced.get(persistentClreplaced);
}
19
Source : MetadataContext.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
public PersistentClreplaced getPersistentClreplacedHostingProperties(MappedSuperclreplacedTypeImpl<?> mappedSuperclreplacedType) {
final PersistentClreplaced persistentClreplaced = mappedSuperClreplacedTypeToPersistentClreplaced.get(mappedSuperclreplacedType);
if (persistentClreplaced == null) {
throw new replacedertionFailure("Could not find PersistentClreplaced for MappedSuperclreplacedType: " + mappedSuperclreplacedType.getJavaType());
}
return persistentClreplaced;
}
19
Source : MetadataContext.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
public void popEnreplacedyWorkedOn(PersistentClreplaced persistentClreplaced) {
final PersistentClreplaced stackTop = stackOfPersistentClreplacedesBeingProcessed.remove(stackOfPersistentClreplacedesBeingProcessed.size() - 1);
if (stackTop != persistentClreplaced) {
throw new replacedertionFailure("Inconsistent popping: " + persistentClreplaced.getEnreplacedyName() + " instead of " + stackTop.getEnreplacedyName());
}
}
19
Source : MetadataContext.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
/*package*/
void registerEnreplacedyType(PersistentClreplaced persistentClreplaced, EnreplacedyTypeImpl<?> enreplacedyType) {
if (ignoreUnsupported && enreplacedyType.getBindableJavaType() == null) {
return;
}
if (enreplacedyType.getBindableJavaType() != null) {
enreplacedyTypes.put(enreplacedyType.getBindableJavaType(), enreplacedyType);
}
enreplacedyTypesByEnreplacedyName.put(persistentClreplaced.getEnreplacedyName(), enreplacedyType);
enreplacedyTypesByPersistentClreplaced.put(persistentClreplaced, enreplacedyType);
orderedMappings.add(persistentClreplaced);
}
19
Source : FilterConfiguration.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
/**
* @author Rob Worsnop
*/
public clreplaced FilterConfiguration {
private final String name;
private final String condition;
private final boolean autoAliasInjection;
private final Map<String, String> aliasTableMap;
private final Map<String, String> aliasEnreplacedyMap;
private final PersistentClreplaced persistentClreplaced;
public FilterConfiguration(String name, String condition, boolean autoAliasInjection, Map<String, String> aliasTableMap, Map<String, String> aliasEnreplacedyMap, PersistentClreplaced persistentClreplaced) {
this.name = name;
this.condition = condition;
this.autoAliasInjection = autoAliasInjection;
this.aliasTableMap = aliasTableMap;
this.aliasEnreplacedyMap = aliasEnreplacedyMap;
this.persistentClreplaced = persistentClreplaced;
}
public String getName() {
return name;
}
public String getCondition() {
return condition;
}
public boolean useAutoAliasInjection() {
return autoAliasInjection;
}
public Map<String, String> getAliasTableMap(SessionFactoryImplementor factory) {
Map<String, String> mergedAliasTableMap = mergeAliasMaps(factory);
if (!mergedAliasTableMap.isEmpty()) {
return mergedAliasTableMap;
} else if (persistentClreplaced != null) {
String table = persistentClreplaced.getTable().getQualifiedName(factory.getDialect(), factory.getSettings().getDefaultCatalogName(), factory.getSettings().getDefaultSchemaName());
return Collections.singletonMap(null, table);
} else {
return Collections.emptyMap();
}
}
private Map<String, String> mergeAliasMaps(SessionFactoryImplementor factory) {
Map<String, String> ret = new HashMap<String, String>();
if (aliasTableMap != null) {
ret.putAll(aliasTableMap);
}
if (aliasEnreplacedyMap != null) {
for (Map.Entry<String, String> entry : aliasEnreplacedyMap.entrySet()) {
ret.put(entry.getKey(), Joinable.clreplaced.cast(factory.getEnreplacedyPersister(entry.getValue())).getTableName());
}
}
return ret;
}
}
19
Source : Ejb3JoinColumn.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
/**
* Override persistent clreplaced on oneToMany Cases for late settings
* Must only be used on second level preplaced binding
*/
public void setPersistentClreplaced(PersistentClreplaced persistentClreplaced, Map<String, Join> joins, Map<XClreplaced, InheritanceState> inheritanceStatePerClreplaced) {
// TODO shouldn't we deduce the clreplacedname from the persistentclreplaced?
this.propertyHolder = PropertyHolderBuilder.buildPropertyHolder(persistentClreplaced, joins, getBuildingContext(), inheritanceStatePerClreplaced);
}
19
Source : Ejb3JoinColumn.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
public void addDefaultJoinColumnName(PersistentClreplaced referencedEnreplacedy, String logicalReferencedColumn) {
final String columnName = buildDefaultColumnName(referencedEnreplacedy, logicalReferencedColumn);
getMappingColumn().setName(columnName);
setLogicalColumnName(columnName);
}
19
Source : BinderHelper.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
/**
* Find the column owner (ie PersistentClreplaced or Join) of columnName.
* If columnName is null or empty, persistentClreplaced is returned
*/
public static Object findColumnOwner(PersistentClreplaced persistentClreplaced, String columnName, MetadataBuildingContext context) {
if (StringHelper.isEmpty(columnName)) {
// shortcut for implicit referenced column names
return persistentClreplaced;
}
PersistentClreplaced current = persistentClreplaced;
Object result;
boolean found = false;
do {
result = current;
Table currentTable = current.getTable();
try {
context.getMetadataCollector().getPhysicalColumnName(currentTable, columnName);
found = true;
} catch (MappingException me) {
// swallow it
}
Iterator joins = current.getJoinIterator();
while (!found && joins.hasNext()) {
result = joins.next();
currentTable = ((Join) result).getTable();
try {
context.getMetadataCollector().getPhysicalColumnName(currentTable, columnName);
found = true;
} catch (MappingException me) {
// swallow it
}
}
current = current.getSuperclreplaced();
} while (!found && current != null);
return found ? result : null;
}
19
Source : TypeSafeActivator.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@SuppressWarnings({ "UnusedDeclaration" })
public static void applyRelationalConstraints(ValidatorFactory factory, Collection<PersistentClreplaced> persistentClreplacedes, Map settings, Dialect dialect, ClreplacedLoaderAccess clreplacedLoaderAccess) {
Clreplaced<?>[] groupsArray = GroupsPerOperation.buildGroupsForOperation(GroupsPerOperation.Operation.DDL, settings, clreplacedLoaderAccess);
Set<Clreplaced<?>> groups = new HashSet<Clreplaced<?>>(Arrays.asList(groupsArray));
for (PersistentClreplaced persistentClreplaced : persistentClreplacedes) {
final String clreplacedName = persistentClreplaced.getClreplacedName();
if (clreplacedName == null || clreplacedName.length() == 0) {
continue;
}
Clreplaced<?> clazz;
try {
clazz = clreplacedLoaderAccess.clreplacedForName(clreplacedName);
} catch (ClreplacedLoadingException e) {
throw new replacedertionFailure("Enreplacedy clreplaced not found", e);
}
try {
applyDDL("", persistentClreplaced, clazz, factory, groups, true, dialect);
} catch (Exception e) {
LOG.unableToApplyConstraints(clreplacedName, e);
}
}
}
19
Source : SetBinder.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
protected Collection createCollection(PersistentClreplaced persistentClreplaced) {
return new org.hibernate.mapping.Set(getBuildingContext(), persistentClreplaced);
}
19
Source : PrimitiveArrayBinder.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
protected Collection createCollection(PersistentClreplaced persistentClreplaced) {
return new PrimitiveArray(getBuildingContext(), persistentClreplaced);
}
19
Source : MapBinder.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
protected Collection createCollection(PersistentClreplaced persistentClreplaced) {
return new org.hibernate.mapping.Map(getBuildingContext(), persistentClreplaced);
}
19
Source : MapBinder.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
private void makeOneToManyMapKeyColumnNullableIfNotInProperty(final XProperty property) {
final org.hibernate.mapping.Map map = (org.hibernate.mapping.Map) this.collection;
if (map.isOneToMany() && property.isAnnotationPresent(MapKeyColumn.clreplaced)) {
final Value indexValue = map.getIndex();
if (indexValue.getColumnSpan() != 1) {
throw new replacedertionFailure("Map key mapped by @MapKeyColumn does not have 1 column");
}
final Selectable selectable = indexValue.getColumnIterator().next();
if (selectable.isFormula()) {
throw new replacedertionFailure("Map key mapped by @MapKeyColumn is a Formula");
}
Column column = (Column) map.getIndex().getColumnIterator().next();
if (!column.isNullable()) {
final PersistentClreplaced persistentClreplaced = ((OneToMany) map.getElement()).getreplacedociatedClreplaced();
// check if the index column has been mapped by the replacedociated enreplacedy to a property;
// @MapKeyColumn only maps a column to the primary table for the one-to-many, so we only
// need to check "un-joined" properties.
if (!propertyIteratorContainsColumn(persistentClreplaced.getUnjoinedPropertyIterator(), column)) {
// The index column is not mapped to an replacedociated enreplacedy property so we can
// safely make the index column nullable.
column.setNullable(true);
}
}
}
}
19
Source : ListBinder.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
protected Collection createCollection(PersistentClreplaced persistentClreplaced) {
return new org.hibernate.mapping.List(getBuildingContext(), persistentClreplaced);
}
19
Source : IdBagBinder.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
protected Collection createCollection(PersistentClreplaced persistentClreplaced) {
return new org.hibernate.mapping.IdentifierBag(getBuildingContext(), persistentClreplaced);
}
19
Source : BagBinder.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
protected Collection createCollection(PersistentClreplaced persistentClreplaced) {
return new org.hibernate.mapping.Bag(getBuildingContext(), persistentClreplaced);
}
19
Source : ArrayBinder.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
protected Collection createCollection(PersistentClreplaced persistentClreplaced) {
return new Array(getBuildingContext(), persistentClreplaced);
}
19
Source : MetadataImpl.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
public org.hibernate.type.Type getIdentifierType(String enreplacedyName) throws MappingException {
final PersistentClreplaced pc = enreplacedyBindingMap.get(enreplacedyName);
if (pc == null) {
throw new MappingException("persistent clreplaced not known: " + enreplacedyName);
}
return pc.getIdentifier().getType();
}
18
Source : ViewBuilder.java
with Apache License 2.0
from teiid
with Apache License 2.0
from teiid
@SuppressWarnings("unchecked")
private FieldInfo getAttributeField(Clreplaced<?> enreplacedyClazz, PersistentClreplaced hibernateClreplaced, String columnName, FieldInfo fieldInfo) {
String propertyName = propertyName(hibernateClreplaced.getPropertyIterator(), hibernateClreplaced.getIdentifierProperty(), columnName);
FieldInfo attribute = new FieldInfo();
if (propertyName != null) {
try {
attribute.field = enreplacedyClazz.getDeclaredField(propertyName);
} catch (NoSuchFieldException | SecurityException e) {
for (Field field : enreplacedyClazz.getDeclaredFields()) {
Embedded embedded = field.getAnnotation(Embedded.clreplaced);
if (embedded != null) {
attribute = getAttributeField(field.getType(), hibernateClreplaced, columnName, fieldInfo);
if (attribute.field != null) {
fieldInfo.field = attribute.field;
fieldInfo.path = fieldInfo.path == null ? field.getName() : field.getName() + "/" + fieldInfo.path;
attribute = fieldInfo;
break;
}
}
}
}
}
return attribute;
}
18
Source : ProxyDefinitions.java
with Apache License 2.0
from quarkusio
with Apache License 2.0
from quarkusio
private static boolean needAnyProxyDefinitions(Metadata storeableMetadata) {
for (PersistentClreplaced persistentClreplaced : storeableMetadata.getEnreplacedyBindings()) {
if (needsProxyGeneration(persistentClreplaced))
return true;
}
return false;
}
18
Source : InterfaceMetadataContributor.java
with Apache License 2.0
from lihangqi
with Apache License 2.0
from lihangqi
@Override
public void contribute(InFlightMetadataCollector metadataCollector, IndexView jandexIndex) {
HibernatePropertyParser parser = new HibernatePropertyParser(metadataCollector);
List<String> handled = new ArrayList<>();
for (PersistentClreplaced pclazz : metadataCollector.getEnreplacedyBindingMap().values()) {
readInterface(parser, pclazz, handled, metadataCollector);
}
}
18
Source : InterfaceMetadataContributor.java
with Apache License 2.0
from lihangqi
with Apache License 2.0
from lihangqi
/**
* 读取接口信息
*/
private void readInterface(HibernatePropertyParser parser, PersistentClreplaced pclazz, List<String> handled, InFlightMetadataCollector metadataCollector) {
// 判断是否已经处理过
if (handled.contains(pclazz.getClreplacedName())) {
return;
}
// 判断是否存在IField接口
Clreplaced<?> clazz = ReflectUtil.clreplacedForName(pclazz.getClreplacedName());
if (clazz == null || !IField.clreplaced.isreplacedignableFrom(clazz)) {
return;
}
// 先处理父类
if (pclazz.getSuperclreplaced() != null) {
readInterface(parser, pclazz.getSuperclreplaced(), handled, metadataCollector);
}
handled.add(pclazz.getClreplacedName());
PropertyDescriptor[] descs = BeanUtils.getPropertyDescriptors(clazz);
List<Clreplaced<?>> ifaces = new ArrayList<>();
for (PropertyDescriptor desc : descs) {
if (isNewProperty(pclazz, desc)) {
parser.parse(buildProperty(clazz, pclazz, desc), pclazz);
// 把字段接口放入一个列表,最后处理索引
Clreplaced<?> iface = desc.getReadMethod().getDeclaringClreplaced();
if (!ifaces.contains(iface)) {
ifaces.add(iface);
}
}
}
// 使用Length注解时,没有将max长度写到hibernate字段映射中,这里手动处理,否则后面的多语言字段无法获取length长度值
try {
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (field.isAnnotationPresent(Length.clreplaced)) {
Length length = field.getAnnotation(Length.clreplaced);
Iterator<org.hibernate.mapping.Column> iterator = pclazz.getTable().getColumnIterator();
while (iterator.hasNext()) {
org.hibernate.mapping.Column column = iterator.next();
if (column.getName().equals(camel2Underline(field.getName()))) {
column.setLength(length.max());
break;
}
}
}
}
} catch (Exception e) {
}
for (Clreplaced<?> iface : ifaces) {
readIndex(pclazz, iface);
}
}
18
Source : InterfaceMetadataContributor.java
with Apache License 2.0
from lihangqi
with Apache License 2.0
from lihangqi
/**
* 构造数据字典属性
*/
private MetaPropertyImpl buildProperty(Clreplaced<?> enreplacedyClreplaced, PersistentClreplaced pclazz, PropertyDescriptor desc) {
MetaPropertyImpl property = new MetaPropertyImpl();
// name/type
property.setName(desc.getName());
property.setType(getType(enreplacedyClreplaced, property, desc));
// feature
Map<String, Object> features = new HashMap<>(1);
HibernatePropertyFeature feature = new HibernatePropertyFeature();
features.put(HibernatePropertyFeature.clreplaced.getName(), feature);
property.setFeatures(features);
// 解析相应的标签
Method read = desc.getReadMethod();
if (read.isAnnotationPresent(Length.clreplaced)) {
parseLength(property, feature, read.getAnnotation(Length.clreplaced));
}
if (read.isAnnotationPresent(Column.clreplaced)) {
parseColumn(property, feature, read.getAnnotation(Column.clreplaced));
}
if (read.isAnnotationPresent(OrderColumn.clreplaced)) {
feature.setIndexColumn(read.getAnnotation(OrderColumn.clreplaced).name());
}
if (read.isAnnotationPresent(Basic.clreplaced)) {
parseBasic(property, feature, read.getAnnotation(Basic.clreplaced));
}
if (read.isAnnotationPresent(Version.clreplaced)) {
feature.setVersion(true);
}
if (read.isAnnotationPresent(ManyToOne.clreplaced)) {
parseManyToOne(property, feature, read.getAnnotation(ManyToOne.clreplaced));
}
if (read.isAnnotationPresent(JoinColumn.clreplaced)) {
parseColumn(property, feature, read.getAnnotation(JoinColumn.clreplaced));
}
if (read.isAnnotationPresent(JoinTable.clreplaced)) {
parseJoinTable(property, feature, read.getAnnotation(JoinTable.clreplaced));
}
return property;
}
18
Source : PropertyFactory.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
private static Constructor getConstructor(PersistentClreplaced persistentClreplaced) {
if (persistentClreplaced == null || !persistentClreplaced.hasPojoRepresentation()) {
return null;
}
try {
return ReflectHelper.getDefaultConstructor(persistentClreplaced.getMappedClreplaced());
} catch (Throwable t) {
return null;
}
}
18
Source : PojoEntityTuplizer.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClreplaced mappedEnreplacedy) {
return mappedProperty.getGetter(mappedEnreplacedy.getMappedClreplaced());
}
18
Source : PojoEntityTuplizer.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
protected ProxyFactory buildProxyFactoryInternal(PersistentClreplaced persistentClreplaced, Getter idGetter, Setter idSetter) {
// TODO : YUCK!!! fix after HHH-1907 is complete
return Environment.getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory(getFactory());
// return getFactory().getSettings().getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory();
}
18
Source : EntityTuplizerFactory.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
/**
* Construct am instance of the default tuplizer for the given enreplacedy-mode.
*
* @param enreplacedyMode The enreplacedy mode for which to build a default tuplizer.
* @param metamodel The enreplacedy metadata.
* @param persistentClreplaced The enreplacedy mapping info.
*
* @return The instantiated tuplizer
*
* @throws HibernateException If no default tuplizer found for that enreplacedy-mode; may be re-thrown from
* {@link #constructTuplizer} too.
*/
public EnreplacedyTuplizer constructDefaultTuplizer(EnreplacedyMode enreplacedyMode, EnreplacedyMetamodel metamodel, PersistentClreplaced persistentClreplaced) {
Clreplaced<? extends EnreplacedyTuplizer> tuplizerClreplaced = defaultImplClreplacedByMode.get(enreplacedyMode);
if (tuplizerClreplaced == null) {
throw new HibernateException("could not determine default tuplizer clreplaced to use [" + enreplacedyMode + "]");
}
return constructTuplizer(tuplizerClreplaced, metamodel, persistentClreplaced);
}
18
Source : DynamicMapEntityTuplizer.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
protected Setter buildPropertySetter(Property mappedProperty, PersistentClreplaced mappedEnreplacedy) {
return buildPropertyAccess(mappedProperty).getSetter();
}
18
Source : DynamicMapEntityTuplizer.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClreplaced mappedEnreplacedy) {
return buildPropertyAccess(mappedProperty).getGetter();
}
18
Source : BytecodeEnhancementMetadataPojoImpl.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
public static BytecodeEnhancementMetadata from(PersistentClreplaced persistentClreplaced) {
final Clreplaced mappedClreplaced = persistentClreplaced.getMappedClreplaced();
final boolean enhancedForLazyLoading = PersistentAttributeInterceptable.clreplaced.isreplacedignableFrom(mappedClreplaced);
final LazyAttributesMetadata lazyAttributesMetadata = enhancedForLazyLoading ? LazyAttributesMetadata.from(persistentClreplaced) : LazyAttributesMetadata.nonEnhanced(persistentClreplaced.getEnreplacedyName());
return new BytecodeEnhancementMetadataPojoImpl(persistentClreplaced.getEnreplacedyName(), mappedClreplaced, enhancedForLazyLoading, lazyAttributesMetadata);
}
18
Source : JoinedSubclassEntityPersister.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
private void replacedociateSubclreplacedNamesToSubclreplacedTableIndexes(PersistentClreplaced persistentClreplaced, Set<String> clreplacedNames, String[][] mapping, SessionFactoryImplementor factory) {
final String tableName = persistentClreplaced.getTable().getQualifiedName(factory.getDialect(), factory.getSettings().getDefaultCatalogName(), factory.getSettings().getDefaultSchemaName());
replacedociateSubclreplacedNamesToSubclreplacedTableIndex(tableName, clreplacedNames, mapping);
Iterator itr = persistentClreplaced.getJoinIterator();
while (itr.hasNext()) {
final Join join = (Join) itr.next();
final String secondaryTableName = join.getTable().getQualifiedName(factory.getDialect(), factory.getSettings().getDefaultCatalogName(), factory.getSettings().getDefaultSchemaName());
replacedociateSubclreplacedNamesToSubclreplacedTableIndex(secondaryTableName, clreplacedNames, mapping);
}
}
18
Source : MetamodelImpl.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
/**
* Prepare the metamodel using the information from the collection of Hibernate
* {@link PersistentClreplaced} models
*
* @param mappingMetadata The mapping information
* @param jpaMetaModelPopulationSetting Should the JPA Metamodel be built as well?
*/
public void initialize(MetadataImplementor mappingMetadata, JpaMetaModelPopulationSetting jpaMetaModelPopulationSetting) {
this.imports.putAll(mappingMetadata.getImports());
primeSecondLevelCacheRegions(mappingMetadata);
final PersisterCreationContext persisterCreationContext = new PersisterCreationContext() {
@Override
public SessionFactoryImplementor getSessionFactory() {
return sessionFactory;
}
@Override
public MetadataImplementor getMetadata() {
return mappingMetadata;
}
};
final PersisterFactory persisterFactory = sessionFactory.getServiceRegistry().getService(PersisterFactory.clreplaced);
for (final PersistentClreplaced model : mappingMetadata.getEnreplacedyBindings()) {
final NavigableRole rootEnreplacedyRole = new NavigableRole(model.getRootClreplaced().getEnreplacedyName());
final EnreplacedyDataAccess accessStrategy = sessionFactory.getCache().getEnreplacedyRegionAccess(rootEnreplacedyRole);
final NaturalIdDataAccess naturalIdAccessStrategy = sessionFactory.getCache().getNaturalIdCacheRegionAccessStrategy(rootEnreplacedyRole);
final EnreplacedyPersister cp = persisterFactory.createEnreplacedyPersister(model, accessStrategy, naturalIdAccessStrategy, persisterCreationContext);
enreplacedyPersisterMap.put(model.getEnreplacedyName(), cp);
if (cp.getConcreteProxyClreplaced() != null && cp.getConcreteProxyClreplaced().isInterface() && !Map.clreplaced.isreplacedignableFrom(cp.getConcreteProxyClreplaced()) && cp.getMappedClreplaced() != cp.getConcreteProxyClreplaced()) {
// IMPL NOTE : we exclude Map based proxy interfaces here because that should
// indicate MAP enreplacedy mode.0
if (cp.getMappedClreplaced().equals(cp.getConcreteProxyClreplaced())) {
// this part handles an odd case in the Hibernate test suite where we map an interface
// as the clreplaced and the proxy. I cannot think of a real life use case for that
// specific test, but..
log.debugf("Enreplacedy [%s] mapped same interface [%s] as clreplaced and proxy", cp.getEnreplacedyName(), cp.getMappedClreplaced());
} else {
final String old = enreplacedyProxyInterfaceMap.put(cp.getConcreteProxyClreplaced(), cp.getEnreplacedyName());
if (old != null) {
throw new HibernateException(String.format(Locale.ENGLISH, "Multiple enreplacedies [%s, %s] named the same interface [%s] as their proxy which is not supported", old, cp.getEnreplacedyName(), cp.getConcreteProxyClreplaced().getName()));
}
}
}
}
for (final Collection model : mappingMetadata.getCollectionBindings()) {
final NavigableRole navigableRole = new NavigableRole(model.getRole());
final CollectionDataAccess accessStrategy = sessionFactory.getCache().getCollectionRegionAccess(navigableRole);
final CollectionPersister persister = persisterFactory.createCollectionPersister(model, accessStrategy, persisterCreationContext);
collectionPersisterMap.put(model.getRole(), persister);
Type indexType = persister.getIndexType();
if (indexType != null && indexType.isreplacedociationType() && !indexType.isAnyType()) {
String enreplacedyName = ((replacedociationType) indexType).getreplacedociatedEnreplacedyName(sessionFactory);
Set<String> roles = collectionRolesByEnreplacedyParticipant.get(enreplacedyName);
if (roles == null) {
roles = new HashSet<>();
collectionRolesByEnreplacedyParticipant.put(enreplacedyName, roles);
}
roles.add(persister.getRole());
}
Type elementType = persister.getElementType();
if (elementType.isreplacedociationType() && !elementType.isAnyType()) {
String enreplacedyName = ((replacedociationType) elementType).getreplacedociatedEnreplacedyName(sessionFactory);
Set<String> roles = collectionRolesByEnreplacedyParticipant.get(enreplacedyName);
if (roles == null) {
roles = new HashSet<>();
collectionRolesByEnreplacedyParticipant.put(enreplacedyName, roles);
}
roles.add(persister.getRole());
}
}
// after *all* persisters and named queries are registered
enreplacedyPersisterMap.values().forEach(EnreplacedyPersister::generateEnreplacedyDefinition);
for (EnreplacedyPersister persister : enreplacedyPersisterMap.values()) {
persister.postInstantiate();
registerEnreplacedyNameResolvers(persister, enreplacedyNameResolvers);
}
collectionPersisterMap.values().forEach(CollectionPersister::postInstantiate);
if (jpaMetaModelPopulationSetting != JpaMetaModelPopulationSetting.DISABLED) {
MetadataContext context = new MetadataContext(sessionFactory, mappingMetadata.getMappedSuperclreplacedMappingsCopy(), jpaMetaModelPopulationSetting);
for (PersistentClreplaced enreplacedyBinding : mappingMetadata.getEnreplacedyBindings()) {
locateOrBuildEnreplacedyType(enreplacedyBinding, context);
}
handleUnusedMappedSuperclreplacedes(context);
context.wrapUp();
this.jpaEnreplacedyTypeMap.putAll(context.getEnreplacedyTypeMap());
this.jpaEmbeddableTypes.addAll(context.getEmbeddableTypeMap());
for (EmbeddableTypeImpl<?> embeddable : jpaEmbeddableTypes) {
this.jpaEmbeddableTypeMap.put(embeddable.getJavaType(), embeddable);
}
this.jpaMappedSuperclreplacedTypeMap.putAll(context.getMappedSuperclreplacedTypeMap());
this.jpaEnreplacedyTypesByEnreplacedyName.putAll(context.getEnreplacedyTypesByEnreplacedyName());
applyNamedEnreplacedyGraphs(mappingMetadata.getNamedEnreplacedyGraphs().values());
}
}
18
Source : MetadataContext.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
private <X> void applyVersionAttribute(PersistentClreplaced persistentClreplaced, EnreplacedyTypeImpl<X> jpaEnreplacedyType) {
final Property declaredVersion = persistentClreplaced.getDeclaredVersion();
if (declaredVersion != null) {
jpaEnreplacedyType.getBuilder().applyVersionAttribute(attributeFactory.buildVersionAttribute(jpaEnreplacedyType, declaredVersion));
}
}
18
Source : AttributeFactory.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
private EnreplacedyMetamodel getDeclarerEnreplacedyMetamodel(AbstractIdentifiableType<?> ownerType) {
final Type.PersistenceType persistenceType = ownerType.getPersistenceType();
if (persistenceType == Type.PersistenceType.ENreplacedY) {
return context.getSessionFactory().getMetamodel().enreplacedyPersister(ownerType.getTypeName()).getEnreplacedyMetamodel();
} else if (persistenceType == Type.PersistenceType.MAPPED_SUPERCLreplaced) {
PersistentClreplaced persistentClreplaced = context.getPersistentClreplacedHostingProperties((MappedSuperclreplacedTypeImpl<?>) ownerType);
return context.getSessionFactory().getMetamodel().enreplacedyPersister(persistentClreplaced.getClreplacedName()).getEnreplacedyMetamodel();
} else {
throw new replacedertionFailure("Cannot get the metamodel for PersistenceType: " + persistenceType);
}
}
18
Source : PersistentTableBulkIdStrategy.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
protected IdTableInfoImpl buildIdTableInfo(PersistentClreplaced enreplacedyBinding, Table idTable, JdbcServices jdbcServices, MetadataImplementor metadata, PreparationContextImpl context) {
final String renderedName = jdbcServices.getJdbcEnvironment().getQualifiedObjectNameFormatter().format(idTable.getQualifiedTableName(), jdbcServices.getJdbcEnvironment().getDialect());
context.creationStatements.add(buildIdTableCreateStatement(idTable, jdbcServices, metadata));
if (dropIdTables) {
context.dropStatements.add(buildIdTableDropStatement(idTable, jdbcServices));
}
return new IdTableInfoImpl(renderedName);
}
18
Source : PersistentTableBulkIdStrategy.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
protected QualifiedTableName determineIdTableName(JdbcEnvironment jdbcEnvironment, PersistentClreplaced enreplacedyBinding) {
return new QualifiedTableName(catalog, schema, super.determineIdTableName(jdbcEnvironment, enreplacedyBinding).getTableName());
}
See More Examples