List of usage examples for org.hibernate.mapping PersistentClass setSelectBeforeUpdate
public void setSelectBeforeUpdate(boolean selectBeforeUpdate)
From source file:org.codehaus.groovy.grails.orm.hibernate.cfg.AbstractGrailsDomainBinder.java
License:Apache License
/** * Binds the specified persistant class to the runtime model based on the * properties defined in the domain class * * @param domainClass The Grails domain class * @param persistentClass The persistant class * @param mappings Existing mappings */// ww w . j ava2s .c o m protected void bindClass(GrailsDomainClass domainClass, PersistentClass persistentClass, Mappings mappings) { // set lazy loading for now persistentClass.setLazy(true); persistentClass.setEntityName(domainClass.getFullName()); persistentClass.setJpaEntityName(unqualify(domainClass.getFullName())); persistentClass.setProxyInterfaceName(domainClass.getFullName()); persistentClass.setClassName(domainClass.getFullName()); // set dynamic insert to false persistentClass.setDynamicInsert(false); // set dynamic update to false persistentClass.setDynamicUpdate(false); // set select before update to false persistentClass.setSelectBeforeUpdate(false); // add import to mappings if (mappings.isAutoImport() && persistentClass.getEntityName().indexOf('.') > 0) { mappings.addImport(persistentClass.getEntityName(), unqualify(persistentClass.getEntityName())); } }
From source file:org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.java
License:Apache License
/** * Binds the specified persistant class to the runtime model based on the * properties defined in the domain class * * @param domainClass The Grails domain class * @param persistentClass The persistant class * @param mappings Existing mappings */// www .j a v a2 s . c o m private static void bindClass(GrailsDomainClass domainClass, PersistentClass persistentClass, Mappings mappings) { // set lazy loading for now persistentClass.setLazy(true); persistentClass.setEntityName(domainClass.getFullName()); persistentClass.setProxyInterfaceName(domainClass.getFullName()); persistentClass.setClassName(domainClass.getFullName()); // set dynamic insert to false persistentClass.setDynamicInsert(false); // set dynamic update to false persistentClass.setDynamicUpdate(false); // set select before update to false persistentClass.setSelectBeforeUpdate(false); // add import to mappings if (mappings.isAutoImport() && persistentClass.getEntityName().indexOf('.') > 0) { mappings.addImport(persistentClass.getEntityName(), StringHelper.unqualify(persistentClass.getEntityName())); } }
From source file:org.grails.orm.hibernate.cfg.AbstractGrailsDomainBinder.java
License:Apache License
/** * Binds the specified persistant class to the runtime model based on the * properties defined in the domain class * * @param domainClass The Grails domain class * @param persistentClass The persistant class * @param mappings Existing mappings */// w w w . j a va 2s . c om protected void bindClass(PersistentEntity domainClass, PersistentClass persistentClass, Mappings mappings) { // set lazy loading for now persistentClass.setLazy(true); final String entityName = domainClass.getName(); persistentClass.setEntityName(entityName); persistentClass.setJpaEntityName(unqualify(entityName)); persistentClass.setProxyInterfaceName(entityName); persistentClass.setClassName(entityName); // set dynamic insert to false persistentClass.setDynamicInsert(false); // set dynamic update to false persistentClass.setDynamicUpdate(false); // set select before update to false persistentClass.setSelectBeforeUpdate(false); // add import to mappings if (mappings.isAutoImport() && persistentClass.getEntityName().indexOf('.') > 0) { mappings.addImport(persistentClass.getEntityName(), unqualify(persistentClass.getEntityName())); } }
From source file:org.grails.orm.hibernate.cfg.GrailsDomainBinder.java
License:Apache License
/** * Binds the specified persistant class to the runtime model based on the * properties defined in the domain class * * @param domainClass The Grails domain class * @param persistentClass The persistant class * @param mappings Existing mappings *///from w ww. ja v a 2s . co m protected void bindClass(PersistentEntity domainClass, PersistentClass persistentClass, InFlightMetadataCollector mappings) { // set lazy loading for now persistentClass.setLazy(true); final String entityName = domainClass.getName(); persistentClass.setEntityName(entityName); persistentClass.setJpaEntityName(unqualify(entityName)); persistentClass.setProxyInterfaceName(entityName); persistentClass.setClassName(entityName); persistentClass.addTuplizer(EntityMode.POJO, GroovyAwarePojoEntityTuplizer.class.getName()); // set dynamic insert to false persistentClass.setDynamicInsert(false); // set dynamic update to false persistentClass.setDynamicUpdate(false); // set select before update to false persistentClass.setSelectBeforeUpdate(false); // add import to mappings String en = persistentClass.getEntityName(); if (mappings.getMetadataBuildingOptions().getMappingDefaults().isAutoImportEnabled() && en.indexOf('.') > 0) { String unqualified = unqualify(en); mappings.addImport(unqualified, en); } }