本文整理汇总了Java中org.eclipse.persistence.internal.databaseaccess.DatabasePlatform类的典型用法代码示例。如果您正苦于以下问题:Java DatabasePlatform类的具体用法?Java DatabasePlatform怎么用?Java DatabasePlatform使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DatabasePlatform类属于org.eclipse.persistence.internal.databaseaccess包,在下文中一共展示了DatabasePlatform类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: entityManagerFactoryBean
import org.eclipse.persistence.internal.databaseaccess.DatabasePlatform; //导入依赖的package包/类
/**
* EntityManager configuration.
*/
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(getDatasource());
em.setJpaDialect(jpaDialect());
em.setPackagesToScan(entityManagerProperties.getPackagesToScan());
em.setPersistenceUnitName(eclipseLinkProperties.getPersistenceUnitName());
final DatabasePlatform dp = new MySQLPlatform();
em.setJpaVendorAdapter(getEclipseLinkJpaVendorAdapter());
//following code will be used for static weaving. Uncomment when creating war.
final Map<String, String> propMap = new HashMap<String, String>();
propMap.put("eclipselink.weaving", eclipseLinkProperties.getWeaving());
em.setJpaPropertyMap(propMap);
// em.setLoadTimeWeaver(loadTimeWeaver()); //comment this when using static weaving. Mostly in development environment inside eclipse
return em;
}
示例2: buildForeignKeyConstraint
import org.eclipse.persistence.internal.databaseaccess.DatabasePlatform; //导入依赖的package包/类
/**
* Build a foreign key constraint using
* FieldDefinition.getForeignKeyFieldName().
*/
@Override
protected ForeignKeyConstraint buildForeignKeyConstraint(FieldDefinition field, DatabasePlatform platform) {
Vector sourceFields = new Vector();
Vector targetFields = new Vector();
ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
DatabaseField tempTargetField = new DatabaseField(field.getForeignKeyFieldName());
DatabaseField tempSourceField = new DatabaseField(field.getName());
sourceFields.add(tempSourceField.getName());
targetFields.add(tempTargetField.getName());
fkConstraint.setSourceFields(sourceFields);
fkConstraint.setTargetFields(targetFields);
fkConstraint.setTargetTable(tempTargetField.getTable().getQualifiedNameDelimited(platform));
String tempName = buildForeignKeyConstraintName(this.getName(), tempSourceField.getName(), platform.getMaxForeignKeyNameSize(), platform);
fkConstraint.setName(tempName);
return fkConstraint;
}
示例3: buildUniqueKeyConstraint
import org.eclipse.persistence.internal.databaseaccess.DatabasePlatform; //导入依赖的package包/类
@Override
public UniqueKeyConstraint buildUniqueKeyConstraint(String name, List<String> fieldNames, int serialNumber, DatabasePlatform platform) {
assert fieldNames.size() > 0;
UniqueKeyConstraint unqConstraint = new UniqueKeyConstraint();
for (String fieldName : fieldNames) {
unqConstraint.addSourceField(fieldName);
}
// If the name was not provided, default one, otherwise use the name provided.
if (name == null || name.equals("")) {
unqConstraint.setName(buildUniqueKeyConstraintName(getName(), serialNumber, platform.getMaxUniqueKeyNameSize()));
} else {
// Hack if off if it exceeds the max size.
if (name.length() > platform.getMaxUniqueKeyNameSize()) {
unqConstraint.setName(name.substring(0, platform.getMaxUniqueKeyNameSize() - 1));
} else {
unqConstraint.setName(name);
}
}
return unqConstraint;
}
示例4: JPAMDefaultTableGenerator
import org.eclipse.persistence.internal.databaseaccess.DatabasePlatform; //导入依赖的package包/类
/**
* Default constructor
*/
public JPAMDefaultTableGenerator(Project project) {
this.project = project;
if (project.getDatasourceLogin().getDatasourcePlatform() instanceof DatabasePlatform) {
this.databasePlatform = (DatabasePlatform) project.getDatasourceLogin().getDatasourcePlatform();
this.generateFKConstraints = this.databasePlatform.supportsForeignKeyConstraints();
}
this.tableMap = new LinkedHashMap();
this.fieldMap = new LinkedHashMap();
this.databaseFields = new LinkedHashMap();
}
示例5: onConnect
import org.eclipse.persistence.internal.databaseaccess.DatabasePlatform; //导入依赖的package包/类
public void onConnect() {
if(this.table.getName().length() == 0) {
this.table.setName(((DatabasePlatform)getDatasourcePlatform()).getDefaultSequenceTableName());
}
super.onConnect();
}