List of usage examples for org.hibernate.mapping JoinedSubclass setKey
public void setKey(KeyValue key)
From source file:org.codehaus.groovy.grails.orm.hibernate.cfg.AbstractGrailsDomainBinder.java
License:Apache License
/** * Binds a joined sub-class mapping using table-per-subclass * * @param sub The Grails sub class * @param joinedSubclass The Hibernate Subclass object * @param mappings The mappings Object * @param gormMapping The GORM mapping object * @param sessionFactoryBeanName the session factory bean name *///from ww w. j a va 2 s.co m protected void bindJoinedSubClass(GrailsDomainClass sub, JoinedSubclass joinedSubclass, Mappings mappings, Mapping gormMapping, String sessionFactoryBeanName) { bindClass(sub, joinedSubclass, mappings); if (joinedSubclass.getEntityPersisterClass() == null) { joinedSubclass.getRootClass() .setEntityPersisterClass(getGroovyAwareJoinedSubclassEntityPersisterClass()); } Table mytable = mappings.addTable(mappings.getSchemaName(), mappings.getCatalogName(), getJoinedSubClassTableName(sub, joinedSubclass, null, mappings, sessionFactoryBeanName), null, false); joinedSubclass.setTable(mytable); LOG.info("Mapping joined-subclass: " + joinedSubclass.getEntityName() + " -> " + joinedSubclass.getTable().getName()); SimpleValue key = new DependantValue(mappings, mytable, joinedSubclass.getIdentifier()); joinedSubclass.setKey(key); GrailsDomainClassProperty identifier = sub.getIdentifier(); String columnName = getColumnNameForPropertyAndPath(identifier, EMPTY_PATH, null, sessionFactoryBeanName); bindSimpleValue(identifier.getType().getName(), key, false, columnName, mappings); joinedSubclass.createPrimaryKey(); // properties createClassProperties(sub, joinedSubclass, mappings, sessionFactoryBeanName); }
From source file:org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.java
License:Apache License
/** * Binds a joined sub-class mapping using table-per-subclass * * @param sub The Grails sub class * @param joinedSubclass The Hibernate Subclass object * @param mappings The mappings Object * @param gormMapping The GORM mapping object * @param sessionFactoryBeanName the session factory bean name *//*from www. ja v a 2s .co m*/ private static void bindJoinedSubClass(GrailsDomainClass sub, JoinedSubclass joinedSubclass, Mappings mappings, @SuppressWarnings("unused") Mapping gormMapping, String sessionFactoryBeanName) { bindClass(sub, joinedSubclass, mappings); if (joinedSubclass.getEntityPersisterClass() == null) { joinedSubclass.getRootClass().setEntityPersisterClass(GroovyAwareJoinedSubclassEntityPersister.class); } Table mytable = mappings.addTable(mappings.getSchemaName(), mappings.getCatalogName(), getJoinedSubClassTableName(sub, joinedSubclass, null, mappings, sessionFactoryBeanName), null, false); joinedSubclass.setTable(mytable); LOG.info("Mapping joined-subclass: " + joinedSubclass.getEntityName() + " -> " + joinedSubclass.getTable().getName()); SimpleValue key = new DependantValue(mappings, mytable, joinedSubclass.getIdentifier()); joinedSubclass.setKey(key); GrailsDomainClassProperty identifier = sub.getIdentifier(); String columnName = getColumnNameForPropertyAndPath(identifier, EMPTY_PATH, null, sessionFactoryBeanName); bindSimpleValue(identifier.getType().getName(), key, false, columnName, mappings); joinedSubclass.createPrimaryKey(); // properties createClassProperties(sub, joinedSubclass, mappings, sessionFactoryBeanName); }
From source file:org.grails.orm.hibernate.cfg.AbstractGrailsDomainBinder.java
License:Apache License
/** * Binds a joined sub-class mapping using table-per-subclass * * @param sub The Grails sub class * @param joinedSubclass The Hibernate Subclass object * @param mappings The mappings Object * @param gormMapping The GORM mapping object * @param sessionFactoryBeanName the session factory bean name *//* w w w. j av a 2 s . com*/ protected void bindJoinedSubClass(HibernatePersistentEntity sub, JoinedSubclass joinedSubclass, Mappings mappings, Mapping gormMapping, String sessionFactoryBeanName) { bindClass(sub, joinedSubclass, mappings); if (joinedSubclass.getEntityPersisterClass() == null) { joinedSubclass.getRootClass() .setEntityPersisterClass(getGroovyAwareJoinedSubclassEntityPersisterClass()); } Table mytable = mappings.addTable(mappings.getSchemaName(), mappings.getCatalogName(), getJoinedSubClassTableName(sub, joinedSubclass, null, mappings, sessionFactoryBeanName), null, false); joinedSubclass.setTable(mytable); LOG.info("Mapping joined-subclass: " + joinedSubclass.getEntityName() + " -> " + joinedSubclass.getTable().getName()); SimpleValue key = new DependantValue(mappings, mytable, joinedSubclass.getIdentifier()); joinedSubclass.setKey(key); final PersistentProperty identifier = sub.getIdentity(); String columnName = getColumnNameForPropertyAndPath(identifier, EMPTY_PATH, null, sessionFactoryBeanName); bindSimpleValue(identifier.getType().getName(), key, false, columnName, mappings); joinedSubclass.createPrimaryKey(); // properties createClassProperties(sub, joinedSubclass, mappings, sessionFactoryBeanName); }
From source file:org.grails.orm.hibernate.cfg.GrailsDomainBinder.java
License:Apache License
/** * Binds a joined sub-class mapping using table-per-subclass * * @param sub The Grails sub class * @param joinedSubclass The Hibernate Subclass object * @param mappings The mappings Object * @param gormMapping The GORM mapping object * @param sessionFactoryBeanName the session factory bean name *//* www . j ava 2 s . co m*/ protected void bindJoinedSubClass(HibernatePersistentEntity sub, JoinedSubclass joinedSubclass, InFlightMetadataCollector mappings, Mapping gormMapping, String sessionFactoryBeanName) { bindClass(sub, joinedSubclass, mappings); String schemaName = getSchemaName(mappings); String catalogName = getCatalogName(mappings); Table mytable = mappings.addTable(schemaName, catalogName, getJoinedSubClassTableName(sub, joinedSubclass, null, mappings, sessionFactoryBeanName), null, false); joinedSubclass.setTable(mytable); LOG.info("Mapping joined-subclass: " + joinedSubclass.getEntityName() + " -> " + joinedSubclass.getTable().getName()); SimpleValue key = new DependantValue(mappings, mytable, joinedSubclass.getIdentifier()); joinedSubclass.setKey(key); final PersistentProperty identifier = sub.getIdentity(); String columnName = getColumnNameForPropertyAndPath(identifier, EMPTY_PATH, null, sessionFactoryBeanName); bindSimpleValue(identifier.getType().getName(), key, false, columnName, mappings); joinedSubclass.createPrimaryKey(); // properties createClassProperties(sub, joinedSubclass, mappings, sessionFactoryBeanName); }