/** * Creating a new TopiaPersistenceContext is equivalent to creating a new transaction * * @param parameter everything needed (specific parameter-object) */ public AbstractTopiaPersistenceContext(AbstractTopiaPersistenceContextConstructorParameter parameter) { this.topiaIdFactory = parameter.getTopiaIdFactory(); this.sessionRegistry = parameter.getSessionRegistry(); this.firesSupport = new TopiaFiresSupport(parameter.getApplicationFiresSupport()); // Hibernate support can be created using the given hibernateProvider this.hibernateSupport = new InternalTopiaHibernateSupport(parameter.getHibernateProvider()); // Now starts the transaction, as this persistenceContext IS the TopiaTransaction startTransaction(); // Create the different supports that may be needed by the DAOs this.jpaSupport = new HibernateTopiaJpaSupport(hibernateSupport, firesSupport); this.sqlSupport = new HibernateTopiaSqlSupport(hibernateSupport); }
@Override public TopiaItMappingTopiaPersistenceContext newPersistenceContext() { TopiaItMappingTopiaPersistenceContext newContext = new TopiaItMappingTopiaPersistenceContext( new AbstractTopiaPersistenceContextConstructorParameter( getHibernateProvider(), getTopiaFiresSupport(), getTopiaIdFactory(), getSessionRegistry() ) ); registerPersistenceContext(newContext); return newContext; }
@Override public GcDbTopiaPersistenceContext newPersistenceContext() { GcDbTopiaPersistenceContext newContext = new GcDbTopiaPersistenceContext( new AbstractTopiaPersistenceContextConstructorParameter( getHibernateProvider(), getTopiaFiresSupport(), getTopiaIdFactory(), getSessionRegistry() ) ); registerPersistenceContext(newContext); return newContext; }
@Override public TopiaItLegacyTopiaPersistenceContext newPersistenceContext() { TopiaItLegacyTopiaPersistenceContext newContext = new TopiaItLegacyTopiaPersistenceContext( new AbstractTopiaPersistenceContextConstructorParameter( getHibernateProvider(), getTopiaFiresSupport(), getTopiaIdFactory(), getSessionRegistry() ) ); registerPersistenceContext(newContext); return newContext; }
@Override public CoselmarTopiaPersistenceContext newPersistenceContext() { CoselmarTopiaPersistenceContext newContext = new CoselmarTopiaPersistenceContext( new AbstractTopiaPersistenceContextConstructorParameter( getHibernateProvider(), getTopiaFiresSupport(), getTopiaIdFactory(), getSessionRegistry() ) ); registerPersistenceContext(newContext); return newContext; }