/** * Sets shouldCreateIndicesOnForeignKeys DDL generation option. */ protected void updateIndexForeignKeys(Map m) { String indexForeignKeys = EntityManagerFactoryProvider.getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.DDL_GENERATION_INDEX_FOREIGN_KEYS, m, this.session); if (indexForeignKeys != null && (indexForeignKeys.length() > 0)) { if (indexForeignKeys.equalsIgnoreCase("true") ){ this.session.getProject().getLogin().setShouldCreateIndicesOnForeignKeys(true); } else if (indexForeignKeys.equalsIgnoreCase("false")){ this.session.getProject().getLogin().setShouldCreateIndicesOnForeignKeys(false); } else { this.session.handleException(ValidationException.invalidBooleanValueForProperty(indexForeignKeys, PersistenceUnitProperties.DDL_GENERATION_INDEX_FOREIGN_KEYS)); } } }
/** * Enable or disable the capability of Native SQL function. * The method needs to be called in deploy stage. */ protected void updateNativeSQLSetting(Map m){ //Set Native SQL flag if it was specified. String nativeSQLString = EntityManagerFactoryProvider.getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.NATIVE_SQL, m, session); if(nativeSQLString!=null){ if(nativeSQLString.equalsIgnoreCase("true") ){ session.getProject().getLogin().useNativeSQL(); }else if (nativeSQLString.equalsIgnoreCase("false")){ session.getProject().getLogin().dontUseNativeSQL(); }else{ session.handleException(ValidationException.invalidBooleanValueForSettingNativeSQL(nativeSQLString)); } } }
/** * Enable or disable forcing field names to uppercase. * The method needs to be called in deploy stage. */ protected void updateUppercaseSetting(Map m){ //Set Native SQL flag if it was specified. String uppercaseString = EntityManagerFactoryProvider.getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.NATIVE_QUERY_UPPERCASE_COLUMNS, m, session); if (uppercaseString != null) { if (uppercaseString.equalsIgnoreCase("true") ){ this.session.getProject().getLogin().setShouldForceFieldNamesToUpperCase(true); } else if (uppercaseString.equalsIgnoreCase("false")) { this.session.getProject().getLogin().setShouldForceFieldNamesToUpperCase(false); } else { this.session.handleException(ValidationException.invalidBooleanValueForProperty(uppercaseString, PersistenceUnitProperties.NATIVE_QUERY_UPPERCASE_COLUMNS)); } } }
public static Project loadDynamicProject(Project project, DatabaseLogin login, DynamicClassLoader dynamicClassLoader) { if (project != null) { if (login == null) { if (project.getLogin() == null) { project.setLogin(new DatabaseLogin()); } } else { project.setLogin(login); } if (project.getLogin().getPlatform() == null) { project.getLogin().setPlatform(new DatabasePlatform()); } project.getLogin().getPlatform().getConversionManager().setLoader(dynamicClassLoader); for (Iterator<?> i = project.getAliasDescriptors().values().iterator(); i.hasNext();) { ClassDescriptor descriptor = (ClassDescriptor) i.next(); if (descriptor.getJavaClass() == null) { createType(dynamicClassLoader, descriptor, project); } } project.convertClassNamesToClasses(dynamicClassLoader); } return project; }
/** * Enable or disable SQL casting. */ protected void updateSQLCastSetting(Map m) { //Set Native SQL flag if it was specified. String sqlCastString = EntityManagerFactoryProvider.getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.SQL_CAST, m, session); if (sqlCastString != null) { if (sqlCastString.equalsIgnoreCase("true")) { session.getProject().getLogin().getPlatform().setIsCastRequired(true); } else if (sqlCastString.equalsIgnoreCase("false")) { session.getProject().getLogin().getPlatform().setIsCastRequired(false); } else { session.handleException(ValidationException.invalidBooleanValueForProperty(sqlCastString, PersistenceUnitProperties.SQL_CAST)); } } }
/** /** * Enable or disable forcing field names to be case insensitive. Implementation of case insensitive column handling relies on setting * both sides to uppercase (the column names from annotations/xml as well as what is returned from the JDBC/statement) * The method needs to be called in deploy stage. */ public static void updateCaseSensitivitySettings(Map m, MetadataProject project, AbstractSession session){ //Set Native SQL flag if it was specified. String insensitiveString = EntityManagerFactoryProvider.getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.UPPERCASE_COLUMN_NAMES, m, session); if (insensitiveString == null || insensitiveString.equalsIgnoreCase("true")) { // Set or default to case in-sensitive. project.setShouldForceFieldNamesToUpperCase(true); session.getProject().getLogin().setShouldForceFieldNamesToUpperCase(true); } else if (insensitiveString.equalsIgnoreCase("false")) { project.setShouldForceFieldNamesToUpperCase(false); session.getProject().getLogin().setShouldForceFieldNamesToUpperCase(false); } else { session.handleException(ValidationException.invalidBooleanValueForProperty(insensitiveString, PersistenceUnitProperties.UPPERCASE_COLUMN_NAMES)); } }
public static Project loadDynamicProject(Project project, DatabaseLogin login, DynamicClassLoader dynamicClassLoader) { if (project != null) { if (login == null) { if (project.getLogin() == null) { project.setLogin(new DatabaseLogin()); project.setLogin(login); if (project.getLogin().getPlatform() == null) { project.getLogin().setPlatform(new DatabasePlatform()); project.getLogin().getPlatform().getConversionManager().setLoader(dynamicClassLoader);
public static Project loadDynamicProject(Project project, DatabaseLogin login, DynamicClassLoader dynamicClassLoader) { if (project != null) { if (login == null) { if (project.getLogin() == null) { project.setLogin(new DatabaseLogin()); project.setLogin(login); if (project.getLogin().getPlatform() == null) { project.getLogin().setPlatform(new DatabasePlatform()); project.getLogin().getPlatform().getConversionManager().setLoader(dynamicClassLoader);
session.log(SessionLog.WARNING, SessionLog.PROPERTIES, "persistence_unit_ignores_statments_cache_setting", new Object[]{null}); } else { session.getProject().getLogin().setShouldCacheAllStatements(true); session.getProject().getLogin().setShouldCacheAllStatements(false); } else { session.handleException(ValidationException.invalidBooleanValueForEnableStatmentsCached(statmentsNeedBeCached)); if (cacheStatementsSize!=null) { try { session.getProject().getLogin().setStatementCacheSize(Integer.parseInt(cacheStatementsSize)); } catch (NumberFormatException e) { session.handleException(ValidationException.invalidCacheStatementsSize(cacheStatementsSize,e.getMessage()));
/** * PUBLIC: * Add the sequence to the session. * Allows to add a new sequence to the session even if the session is connected. * If the session is connected then the sequence is added only * if there is no sequence with the same name already in use. * Call this method before addDescriptor(s) if need to add new descriptor * with a new non-default sequence to connected session. * * @see #addSequences(Collection) */ public void addSequence(Sequence sequence) { getProject().getLogin().getDatasourcePlatform().addSequence(sequence, this.getSequencingHome().isConnected()); }
/** * PUBLIC: * Add the sequence to the session. * Allows to add a new sequence to the session even if the session is connected. * If the session is connected then the sequence is added only * if there is no sequence with the same name already in use. * Call this method before addDescriptor(s) if need to add new descriptor * with a new non-default sequence to connected session. * * @see #addSequences(Collection) */ @Override public void addSequence(Sequence sequence) { getProject().getLogin().getDatasourcePlatform().addSequence(sequence, this.getSequencingHome().isConnected()); }
DatabaseLogin login = project.getLogin(); Sequence seq = login.getSequence(sequenceName); if(seq instanceof DefaultSequence) {
DatasourceLogin login = m_session.getProject().getLogin(); login.setTableQualifier(tempGenerator.processQualifier());
DatabaseLogin login = this.project.getLogin(); Sequence seq = login.getSequence(sequenceName); if(seq instanceof DefaultSequence) {
DatabaseLogin login = this.project.getLogin(); Sequence seq = login.getSequence(sequenceName); if(seq instanceof DefaultSequence) {