Examples of EBStore


Examples of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore

     * Verifies if the bean created in extended persistence context in the
     * startup method, and, a bean that was goten using the find method have the
     * same reference.
     */
    public void testExtendedPersistenceContext() {
        EBStore ebstoreResult = entityManagerExtended.find(EBStore.class, ID_EXTENDED);
        assertTrue(ebstoreResult == ebstoreExtended,
                "The entities were goten in the same persistence context, so they should have the same reference.");
    }
View Full Code Here

Examples of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore

     * @param entityManager Entity Manager
     * @param name row name
     * @throws Exception if a problem occurs
     */
    public static void checkInstance(final EntityManager entityManager, final String name) throws Exception{
        EBStore store = new EBStore();
        store.setId(store.hashCode());
        store.setName(name);
        entityManager.persist(store);

        // flush only if there is a transaction
        UserTransaction utx = TransactionHelper.getInternalUserTransaction();
        if (utx != null) {
            if (utx.getStatus() == Status.STATUS_ACTIVE) {
                entityManager.flush();
            }
        }

        if (entityManager.find(EBStore.class, Integer.valueOf(store.hashCode())) == null){
            throw new Exception("EBStore was created, but it wasn't found after the commit.");
        }
    }
View Full Code Here

Examples of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore

    /**
     * Deletes the bean with the default value.
     */
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public void deleteBean() {
        EBStore ebstore = emDelete.find(EBStore.class, new Integer(ID));
        if (ebstore != null) {
            emDelete.remove(ebstore);
        }
        emDelete.flush();
    }
View Full Code Here

Examples of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore

     * transaction to persist the bean.
     */
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public void createBeanRequiresNewWithClientTransaction() {
        deleteBean();
        EBStore ebstore = new EBStore();
        ebstore.setId(ID);
        ebstore.setName(NAME);
        persistRequiresNew(ebstore);
    }
View Full Code Here

Examples of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore

     * that has a transaction to persist the bean.
     */
    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public void createBeanRequiresNewWithoutClientTransaction() {
        deleteBean();
        EBStore ebstore = new EBStore();
        ebstore.setId(ID);
        ebstore.setName(NAME);
        persistRequiresNew(ebstore);
    }
View Full Code Here

Examples of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore

     * to persist the bean.
     */
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public void createBeanRequired() {
        deleteBean();
        EBStore ebstore = new EBStore();
        ebstore.setId(ID);
        ebstore.setName(NAME);
        persistRequired(ebstore);
    }
View Full Code Here

Examples of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore

     * @param id the entity primary key.
     * @param name the entity name.
     * @return the ebstore completed.
     */
    private EBStore completeEBStore(final int id, final String name) {
        EBStore ebstore = new EBStore();
        ebstore.setId(id);
        ebstore.setName(name);
        return ebstore;
    }
View Full Code Here

Examples of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore

     * @param id the entity primary key.
     * @param name the entity name.
     * @param newName the name that the entity receives after to be detached.
     */
    public void mergeEBStore(final int id, final String name, final String newName) {
        EBStore ebstore = completeEBStore(id, name);
        em.persist(ebstore);
        //makes the entity detached
        em.clear();
        //changes the entity name
        ebstore.setName(newName);
        EBStore ebstoreMerged = em.merge(ebstore);
        assertEquals(newName, ebstoreMerged.getName(), "The entity was not merged.");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.