EclipseLink EntityManager.merge返回旧数据

时间:2015-05-21 13:31:22

标签: java jpa merge eclipselink jpa-2.1

奇怪的行为,只发生em.merge()的第一次调用;后续调用似乎可以正常工作。

这是EJB

@Stateless
@Local
public class PersistenceService implements Serializable
{
    private static final long serialVersionUID = 1L;

    private static final Logger logger = LoggerFactory.getLogger(PersistenceService.class);

    @PersistenceContext
    private EntityManager em;

    public EntityManager getEntityManager()
    {
        return em;
    }

    @PostConstruct
    public void init()
    {
        logger.debug("called");

        em.setFlushMode(FlushModeType.COMMIT);

        em.setProperty("javax.persistence.cache.retrieveMode", CacheRetrieveMode.USE);
        em.setProperty("javax.persistence.cache.storeMode", CacheStoreMode.REFRESH);

        UnitOfWork uow = em.unwrap(UnitOfWork.class);
        uow.setShouldPerformDeletesFirst(true);
    }

    public <T extends AbstractEntity> T update(T entity)
    {
        logger.debug("em.contains(entity): {}", em.contains(entity));

        if(entity instanceof NamedEntity)
        {
            logger.debug("========================> name: {}", ((NamedEntity) entity).getName());
        }

        // em.clear();
        T entity2 = em.merge(entity);
        // em.flush();
        // em.refresh(entity2);

        if(entity instanceof NamedEntity)
        {
            logger.debug("========================> name: {}", ((NamedEntity) entity2).getName());
        }

        return entity2;
    }
}

这是输出(方括号中有[id@version]):

Info: update[:192] - em.contains(entity): false
Info: update[:205] - ========================> name: WP 6.6 - SYSTEM SAFETY ASSESSMENT aaaaaaaaaaaaaaaaaaaaaaaaaaaa
Info: update[:216] - ========================> name: WP 6.6 - SYSTEM SAFETY ASSESSMENT

我在使用EclipseLink 2.6.0的GlassFish 4.1

实体由JSF @ViewScoped bean读取:

@ManagedBean
@ViewScoped
public class EntityBean<T extends AbstractEntity> implements Serializable
{
    @EJB
    protected PersistenceService service;

    protected T entity;

    @PostConstruct
    public void init()
    {
        Class<T> entityClass = ...;
        Long entityId = ...;

        entity = service.find(entityClass, entityId);
    }

    public String update()
    {
        entity = service.update(entity);

        return null;
    }

    ...
}

,这是合并未发生时的输出:

Info: i.s.edea2.jsf.controller.EntityBean.update[:116] - ========================> name: WP 6.6 - SYSTEM SAFETY ASSESSMENT ggg
Info: it.shape.edea2.ejb.PersistenceService.update[:107] - em.contains(entity): false
Info: it.shape.edea2.ejb.PersistenceService.update[:112] - ========================> name: WP 6.6 - SYSTEM SAFETY ASSESSMENT ggg
Finer: client acquired: 498718168
Finer: TX binding to tx mgr, status=STATUS_ACTIVE
Finer: acquire unit of work: 2093541910
Finest: Merge clone with references it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Finest: Register the existing object it.shape.edea2.jpa.Manufacturer@3aaf83f[213@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a88239[151@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c0419[13@3]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03f8[5@3]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03fd[9@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03fb[8@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03f7[4@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a8851e[60@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03f8[5@3]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a8851e[60@2]
Finest: Register the existing object it.shape.edea2.jpa.ItemType@135ab[147@10362]
Finest: Register the existing object it.shape.edea2.jpa.UnitRegistration@d40e7aea[69545@1]
Finest: Register the existing object it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Finest: Execute query ReadObjectQuery(referenceClass=Item )
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT ID, DTYPE, CODE, CUSTOMERDECISIONDATE, CUSTOMERDECISIONNOTE, CUSTOMERSTATUS, CUSTOMERSUBMITDATE, CUSTOMERSUBMITNOTE, DESCRIPTION, EXPECTEDRELEASEDATE, NAME, RELEASEDATE, REVISION, SECURITYLEVEL, STATUS, SUBSTATUS, VERSION, MANUFACTURER_ID, RESPONSIBLE_ID, UNITTYPE_ID, CREATED_ID, UPDATED_ID, ACTIVITY_ID, CATEGORY_ID, DOCUMENTATIONLEVEL_ID, GENERATOR_CHANGE_ID, CONSORTIUMPARTNUMBER, EQUIPMENTCODE, ITEM_FAMILY, NUC, OEMPARTNUMBER FROM UNIT WHERE ((ID = ?) AND (DTYPE = ?))
    bind => [69545, Item]
Finest: Connection released to connection pool [read].
Finest: Execute query ReadObjectQuery(name="manufacturer" referenceClass=Manufacturer sql="SELECT ID, CITY, CODE, EMAIL, ENABLED, NAME, NATION, STATE, STREET, URL, VERSION, ZONE FROM MANUFACTURER WHERE (ID = ?)")
FetchGroup(){code, city, nation, zone, street, name, id, state, version, email, enabled, url}
Finest: Execute query ReadObjectQuery(name="responsible" referenceClass=Person sql="SELECT t0.ID, t0.DTYPE, t0.CODE, t0.NAME, t0.VERSION, t1.EMAIL, t1.FIRSTNAME, t1.LASTNAME, t1.LOCALE, t1.TIMEZONE, t1.OFFICE_ID, t1.PROFILE_ID FROM SUBJECT t0, PERSON t1 WHERE ((t0.ID = ?) AND ((t1.ID = t0.ID) AND (t0.DTYPE = ?)))")
FetchGroup(){rightSet, lastName, code, profile, timeZone, office, locale, roleList, version, subordinateOfficeList, firstName, accountList, name, takenProxyList, id, givenProxyList, teamList, email}
Finest: Execute query ReadObjectQuery(name="type" referenceClass=UnitType sql="SELECT ID, DTYPE, ATTACHMENTSALLOWED, CODE, CUSTOMERPERMISSION, ENABLED, EXPECTEDRELEASEDATEPERMISSION, NAME, PROGRESSIVE, PROGRESSIVEYEAR, TYPEORDER, VERSION FROM UNIT_TYPE WHERE (ID = ?)")
FetchGroup(){code, typeOrder, customFieldDefinitionList, actionRuleList, progressiveYear, version, enabled, attachmentsAllowed, expectedReleaseDatePermission, customerPermission, name, progressive, id, documentRuleList}
Finest: Execute query ReadObjectQuery(name="created" referenceClass=UnitRegistration )
Finest: Execute query ReadObjectQuery(name="media" referenceClass=ArchiveMedia sql="SELECT ID, CODE, NAME, TYPE, VERSION, SHELF_ID, UNIT_ID FROM ARCHIVE_MEDIA WHERE (UNIT_ID = ?)")
FetchGroup(){unit, code, name, id, type, version, shelf}
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT ID, CODE, NAME, TYPE, VERSION, SHELF_ID, UNIT_ID FROM ARCHIVE_MEDIA WHERE (UNIT_ID = ?)
    bind => [69545]
Finest: Connection released to connection pool [read].
Finest: Register the existing object it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Finest: Execute query ReadObjectQuery(name="updated" referenceClass=UnitRegistration )
Finest: Register the existing object it.shape.edea2.jpa.UnitRegistration@d487cc1a[202795@1]
Finest: Execute query ReadAllQuery(name="actionList" referenceClass=Action sql="SELECT t1.ID, t1.DTYPE, t1.CODE, t1.CUSTOMERDECISIONDATE, t1.CUSTOMERDECISIONNOTE, t1.CUSTOMERSTATUS, t1.CUSTOMERSUBMITDATE, t1.CUSTOMERSUBMITNOTE, t1.EXPECTEDRELEASEDATE, t1.NAME, t1.RELEASEDATE, t1.REVISION, t1.SECURITYLEVEL, t1.STATUS, t1.SUBSTATUS, t1.VERSION, t1.MANUFACTURER_ID, t1.RESPONSIBLE_ID, t1.UNITTYPE_ID, t1.CREATED_ID, t1.UPDATED_ID, t1.OPENDATE, t1.SUSPENDEDDATE, t1.PHASE_ID, t1.SEVERITY_ID FROM ACTION_RELATION t0, UNIT t1 WHERE (((t0.PARENT_ID = ?) AND (t1.ID = t0.CHILD_ID)) AND (t1.DTYPE = ?))")
FetchGroup(){code, customerSubmitDate, media, type, parentList, customerSubmitNote, manufacturer, productSet, customerStatus, securityLevel, registrationList, attachmentList, responsible, approvalList, customFieldMap, id, projectSet, phase, severity, customerDecisionDate, customerDecisionNote, releaseDate, workflowExecution, created, actionList, version, subStatus, revision, authorizationList, documentList, name, expectedReleaseDate, openDate, suspendedDate, updated, status}
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT t1.ID, t1.DTYPE, t1.CODE, t1.CUSTOMERDECISIONDATE, t1.CUSTOMERDECISIONNOTE, t1.CUSTOMERSTATUS, t1.CUSTOMERSUBMITDATE, t1.CUSTOMERSUBMITNOTE, t1.EXPECTEDRELEASEDATE, t1.NAME, t1.RELEASEDATE, t1.REVISION, t1.SECURITYLEVEL, t1.STATUS, t1.SUBSTATUS, t1.VERSION, t1.MANUFACTURER_ID, t1.RESPONSIBLE_ID, t1.UNITTYPE_ID, t1.CREATED_ID, t1.UPDATED_ID, t1.OPENDATE, t1.SUSPENDEDDATE, t1.PHASE_ID, t1.SEVERITY_ID FROM ACTION_RELATION t0, UNIT t1 WHERE (((t0.PARENT_ID = ?) AND (t1.ID = t0.CHILD_ID)) AND (t1.DTYPE = ?))
    bind => [69545, Action]
Finest: Connection released to connection pool [read].
Finest: Execute query ReadAllQuery(name="baselineList" referenceClass=Baseline sql="SELECT t1.ID, t1.CODE, t1.NAME, t1.REVISION, t1.TYPE, t1.VERSION, t1.PROJECT_ID, t1.ROOT_ID FROM BASELINE_DELIVERABLE t0, BASELINE t1 WHERE ((t0.DELIVERABLE_ID = ?) AND (t1.ID = t0.BASELINE_ID))")
FetchGroup(){code, root, deliverableList, name, project, id, type, version, revision}
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT t1.ID, t1.CODE, t1.NAME, t1.REVISION, t1.TYPE, t1.VERSION, t1.PROJECT_ID, t1.ROOT_ID FROM BASELINE_DELIVERABLE t0, BASELINE t1 WHERE ((t0.DELIVERABLE_ID = ?) AND (t1.ID = t0.BASELINE_ID))
    bind => [69545]
Finest: Connection released to connection pool [read].
Finest: Execute query ReadAllQuery(name="documentList" referenceClass=Document sql="SELECT t1.ID, t1.DTYPE, t1.CODE, t1.CUSTOMERDECISIONDATE, t1.CUSTOMERDECISIONNOTE, t1.CUSTOMERSTATUS, t1.CUSTOMERSUBMITDATE, t1.CUSTOMERSUBMITNOTE, t1.EXPECTEDRELEASEDATE, t1.NAME, t1.RELEASEDATE, t1.REVISION, t1.SECURITYLEVEL, t1.STATUS, t1.SUBSTATUS, t1.VERSION, t1.MANUFACTURER_ID, t1.RESPONSIBLE_ID, t1.UNITTYPE_ID, t1.CREATED_ID, t1.UPDATED_ID, t1.ACTIVITY_ID, t1.CATEGORY_ID, t1.DOCUMENTATIONLEVEL_ID, t1.GENERATOR_CHANGE_ID, t1.DOCUMENT_FAMILY FROM DOCUMENT_RELATION t0, UNIT t1 WHERE (((t0.PARENT_ID = ?) AND (t1.ID = t0.CHILD_ID)) AND (t1.DTYPE = ?))")
FetchGroup(){code, activity, customerSubmitDate, changeList, media, type, parentList, customerSubmitNote, manufacturer, productSet, customerStatus, securityLevel, registrationList, attachmentList, responsible, approvalList, customFieldMap, id, projectSet, generatorChange, lifecycleAssociationList, remarkList, customerDecisionDate, customerDecisionNote, releaseDate, workflowExecution, created, documentationLevel, actionList, version, subStatus, revision, authorizationList, documentList, name, expectedReleaseDate, family, category, updated, status, baselineList}
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT t1.ID, t1.DTYPE, t1.CODE, t1.CUSTOMERDECISIONDATE, t1.CUSTOMERDECISIONNOTE, t1.CUSTOMERSTATUS, t1.CUSTOMERSUBMITDATE, t1.CUSTOMERSUBMITNOTE, t1.EXPECTEDRELEASEDATE, t1.NAME, t1.RELEASEDATE, t1.REVISION, t1.SECURITYLEVEL, t1.STATUS, t1.SUBSTATUS, t1.VERSION, t1.MANUFACTURER_ID, t1.RESPONSIBLE_ID, t1.UNITTYPE_ID, t1.CREATED_ID, t1.UPDATED_ID, t1.ACTIVITY_ID, t1.CATEGORY_ID, t1.DOCUMENTATIONLEVEL_ID, t1.GENERATOR_CHANGE_ID, t1.DOCUMENT_FAMILY FROM DOCUMENT_RELATION t0, UNIT t1 WHERE (((t0.PARENT_ID = ?) AND (t1.ID = t0.CHILD_ID)) AND (t1.DTYPE = ?))
    bind => [69545, Document]
Finest: Connection released to connection pool [read].
Finest: Execute query ReadAllQuery(name="productSet" referenceClass=Product sql="SELECT t1.ID, t1.CODE, t1.ENDDATE, t1.LASTASSIGNEDCODE, t1.NAME, t1.STARTDATE, t1.VERSION, t1.RESPONSIBLE_ID, t1.ROOT_ID FROM PRODUCT_UNIT t0, PRODUCT t1 WHERE ((t0.UNIT_ID = ?) AND (t1.ID = t0.PRODUCT_ID))")
FetchGroup(){code, lastAssignedCode, endDate, responsible, root, name, unitList, id, version, startDate, operativeList}
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT t1.ID, t1.CODE, t1.ENDDATE, t1.LASTASSIGNEDCODE, t1.NAME, t1.STARTDATE, t1.VERSION, t1.RESPONSIBLE_ID, t1.ROOT_ID FROM PRODUCT_UNIT t0, PRODUCT t1 WHERE ((t0.UNIT_ID = ?) AND (t1.ID = t0.PRODUCT_ID))
    bind => [69545]
Finest: Connection released to connection pool [read].
Finest: Execute query ReadAllQuery(name="projectSet" referenceClass=Project sql="SELECT t1.ID, t1.CODE, t1.ENDDATE, t1.LASTASSIGNEDCODE, t1.NAME, t1.STARTDATE, t1.VERSION, t1.RESPONSIBLE_ID, t1.ROOT_ID, t1.TYPE_ID FROM PROJECT_UNIT t0, PROJECT t1 WHERE ((t0.UNIT_ID = ?) AND (t1.ID = t0.PROJECT_ID))")
FetchGroup(){code, lastAssignedCode, endDate, assuranceOutputList, unitList, type, version, responsible, root, name, id, startDate, lifecycleAssociationList, operativeList, baselineList}
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT t1.ID, t1.CODE, t1.ENDDATE, t1.LASTASSIGNEDCODE, t1.NAME, t1.STARTDATE, t1.VERSION, t1.RESPONSIBLE_ID, t1.ROOT_ID, t1.TYPE_ID FROM PROJECT_UNIT t0, PROJECT t1 WHERE ((t0.UNIT_ID = ?) AND (t1.ID = t0.PROJECT_ID))
    bind => [69545]
Finest: Connection released to connection pool [read].
Finest: Register the existing object it.shape.edea2.jpa.Project@26e0957c[254@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@92af664e[2@3]
Finest: Register the existing object it.shape.edea2.jpa.Office@620[1@1]
Finest: Register the existing object it.shape.edea2.jpa.Item@7a006f21[16094@2]{A1000|PI060060-09|}
Finest: Register the existing object it.shape.edea2.jpa.Manufacturer@3aaf83f[213@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@92af664e[2@3]
Finest: Register the existing object it.shape.edea2.jpa.ItemType@1059c[128@271]
Finest: Register the existing object it.shape.edea2.jpa.UnitRegistration@34cb396d[16094@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a88160[173@5]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c041b[15@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03f8[5@3]
Finest: Register the existing object it.shape.edea2.jpa.Item@7a006f21[16094@2]{A1000|PI060060-09|}
Finest: Register the existing object it.shape.edea2.jpa.ProjectType@923007ea[13@117]
Finest: Register the existing object it.shape.edea2.jpa.ProtoDeliverable@92300b8c[3@2]
Finest: Register the existing object it.shape.edea2.jpa.ItemType@1059c[128@271]
Finest: Execute query ReadAllQuery(name="remarkList" referenceClass=Remark sql="SELECT t1.ID, t1.CODE, t1.NAME, t1.SECURITYLEVEL, t1.TYPE, t1.VERSION, t1.RESPONSIBLE_ID, t1.SEVERITY_ID FROM DELIVERABLE_REMARK t0, REMARK t1 WHERE ((t0.DELIVERABLE_ID = ?) AND (t1.ID = t0.REMARK_ID))")
FetchGroup(){securityLevel, severity, authorizationList, code, attachmentList, reworkList, responsible, deliverableList, name, id, type, version}
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT t1.ID, t1.CODE, t1.NAME, t1.SECURITYLEVEL, t1.TYPE, t1.VERSION, t1.RESPONSIBLE_ID, t1.SEVERITY_ID FROM DELIVERABLE_REMARK t0, REMARK t1 WHERE ((t0.DELIVERABLE_ID = ?) AND (t1.ID = t0.REMARK_ID))
    bind => [69545]
Finest: Connection released to connection pool [read].
Finest: Execute query ReadAllQuery(name="childItemList" referenceClass=ItemRelation sql="SELECT ID, IOR, QUANTITY, VERSION, CHILD_ID, PARENT_ID FROM ITEM_RELATION WHERE (PARENT_ID = ?)")
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT ID, IOR, QUANTITY, VERSION, CHILD_ID, PARENT_ID FROM ITEM_RELATION WHERE (PARENT_ID = ?)
    bind => [69545]
Finest: Connection released to connection pool [read].
Finest: Execute query ReadAllQuery(name="lifecycleAssociationList" referenceClass=LifecycleAssociation sql="SELECT ID, EXPECTEDDELIVERYDATE, MANDATORY, ASSOCIATION_MODE, PHASE, VERSION, DELIVERABLE_ID, PROJECT_ID FROM LIFECYCLE_ASSOCIATION WHERE (DELIVERABLE_ID = ?)")
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT ID, EXPECTEDDELIVERYDATE, MANDATORY, ASSOCIATION_MODE, PHASE, VERSION, DELIVERABLE_ID, PROJECT_ID FROM LIFECYCLE_ASSOCIATION WHERE (DELIVERABLE_ID = ?)
    bind => [69545]
Finest: Connection released to connection pool [read].
Finest: Execute query ReadAllQuery(name="parentItemList" referenceClass=ItemRelation sql="SELECT ID, IOR, QUANTITY, VERSION, CHILD_ID, PARENT_ID FROM ITEM_RELATION WHERE (CHILD_ID = ?)")
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT ID, IOR, QUANTITY, VERSION, CHILD_ID, PARENT_ID FROM ITEM_RELATION WHERE (CHILD_ID = ?)
    bind => [69545]
Finest: Connection released to connection pool [read].
Finest: Register the existing object it.shape.edea2.jpa.ItemRelation@47f45362[6024@1]
Finest: Register the existing object it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Finest: Register the existing object it.shape.edea2.jpa.Item@b490b8d5[16119@3]{A1000|PI060060-09.80|}
Finest: Register the existing object it.shape.edea2.jpa.Manufacturer@3aaf83f[213@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a88239[151@2]
Finest: Register the existing object it.shape.edea2.jpa.ItemType@135a6[146@2524]
Finest: Register the existing object it.shape.edea2.jpa.UnitRegistration@25f5fb38[16119@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a885d9[162@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c0419[13@3]
Finest: Register the existing object it.shape.edea2.jpa.Item@b490b8d5[16119@3]{A1000|PI060060-09.80|}
Finest: Execute query ReadAllQuery(name="authorizationList" referenceClass=Authorization sql="SELECT ID, INTERVENTION, VERSION, SUBJECT_ID, ELEMENT_ORDER FROM AUTHORIZATION WHERE (UNIT_ID = ?)")
Finest: Connection acquired from connection pool [read].
Finest: reconnecting to external connection pool
Fine: SELECT ID, INTERVENTION, VERSION, SUBJECT_ID, ELEMENT_ORDER FROM AUTHORIZATION WHERE (UNIT_ID = ?)
    bind => [69545]
Finest: Connection released to connection pool [read].
Finest: Register the existing object it.shape.edea2.jpa.Authorization@e0a88258[23960@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a88239[151@2]
Info: it.shape.edea2.ejb.PersistenceService.update[:134] - ========================> name: WP 6.6 - SYSTEM SAFETY ASSESSMENT
Finer: TX beforeCompletion callback, status=STATUS_ACTIVE
Finer: begin unit of work commit
Finer: TX beginTransaction, status=STATUS_ACTIVE
Finest: Execute query UpdateObjectQuery(it.shape.edea2.jpa.ItemType@135ab[147@10362])
Finest: Connection acquired from connection pool [default].
Finest: reconnecting to external connection pool
Fine: UPDATE UNIT_TYPE SET VERSION = ? WHERE ((ID = ?) AND (VERSION = ?))
    bind => [10363, 147, 10362]
Finest: Connection released to connection pool [default].
Finer: TX afterCompletion callback, status=COMMITTED
Finer: end unit of work commit
Finer: release unit of work
Finer: client released
Info: i.s.edea2.jsf.controller.EntityBean.setEntity[:211] - entity: it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Info: i.s.edea2.jsf.controller.EntityBean.update[:127] - ========================> name: WP 6.6 - SYSTEM SAFETY ASSESSMENT

这是secon尝试的输出,当合并发生时:

Info: i.s.edea2.jsf.controller.EntityBean.update[:116] - ========================> name: WP 6.6 - SYSTEM SAFETY ASSESSMENT hhh
Info: it.shape.edea2.ejb.PersistenceService.update[:107] - em.contains(entity): false
Info: it.shape.edea2.ejb.PersistenceService.update[:112] - ========================> name: WP 6.6 - SYSTEM SAFETY ASSESSMENT hhh
Finer: client acquired: 1596825453
Finer: TX binding to tx mgr, status=STATUS_ACTIVE
Finer: acquire unit of work: 16368269
Finest: Merge clone with references it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Finest: Register the existing object it.shape.edea2.jpa.Manufacturer@3aaf83f[213@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a88239[151@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c0419[13@3]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03f8[5@3]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03fd[9@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03fb[8@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03f7[4@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a8851e[60@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03f8[5@3]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a8851e[60@2]
Finest: Register the existing object it.shape.edea2.jpa.ItemType@135ab[147@10363]
Finest: Register the existing object it.shape.edea2.jpa.UnitRegistration@d40e7aea[69545@1]
Finest: Register the existing object it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Finest: Register the existing object it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Finest: Register the existing object it.shape.edea2.jpa.UnitRegistration@d487cc1a[202795@1]
Finest: Register the existing object it.shape.edea2.jpa.Project@26e0957c[254@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@92af664e[2@3]
Finest: Register the existing object it.shape.edea2.jpa.Office@620[1@1]
Finest: Register the existing object it.shape.edea2.jpa.Item@7a006f21[16094@2]{A1000|PI060060-09|}
Finest: Register the existing object it.shape.edea2.jpa.Manufacturer@3aaf83f[213@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@92af664e[2@3]
Finest: Register the existing object it.shape.edea2.jpa.ItemType@1059c[128@271]
Finest: Register the existing object it.shape.edea2.jpa.UnitRegistration@34cb396d[16094@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a88160[173@5]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c041b[15@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c03f8[5@3]
Finest: Register the existing object it.shape.edea2.jpa.Item@7a006f21[16094@2]{A1000|PI060060-09|}
Finest: Register the existing object it.shape.edea2.jpa.ProjectType@923007ea[13@117]
Finest: Register the existing object it.shape.edea2.jpa.ProtoDeliverable@92300b8c[3@2]
Finest: Register the existing object it.shape.edea2.jpa.ItemType@1059c[128@271]
Finest: Register the existing object it.shape.edea2.jpa.ItemRelation@47f45362[6024@1]
Finest: Register the existing object it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Finest: Register the existing object it.shape.edea2.jpa.Item@b490b8d5[16119@3]{A1000|PI060060-09.80|}
Finest: Register the existing object it.shape.edea2.jpa.Manufacturer@3aaf83f[213@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a88239[151@2]
Finest: Register the existing object it.shape.edea2.jpa.ItemType@135a6[146@2524]
Finest: Register the existing object it.shape.edea2.jpa.UnitRegistration@25f5fb38[16119@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a885d9[162@2]
Finest: Register the existing object it.shape.edea2.jpa.Office@184c0419[13@3]
Finest: Register the existing object it.shape.edea2.jpa.Item@b490b8d5[16119@3]{A1000|PI060060-09.80|}
Finest: Register the existing object it.shape.edea2.jpa.Authorization@e0a88258[23960@1]
Finest: Register the existing object it.shape.edea2.jpa.Person@e0a88239[151@2]
Info: it.shape.edea2.ejb.PersistenceService.update[:134] - ========================> name: WP 6.6 - SYSTEM SAFETY ASSESSMENT hhh
Finer: TX beforeCompletion callback, status=STATUS_ACTIVE
Finer: begin unit of work commit
Finer: TX beginTransaction, status=STATUS_ACTIVE
Finest: Execute query UpdateObjectQuery(it.shape.edea2.jpa.ItemType@135ab[147@10363])
Finest: Connection acquired from connection pool [default].
Finest: reconnecting to external connection pool
Fine: UPDATE UNIT_TYPE SET VERSION = ? WHERE ((ID = ?) AND (VERSION = ?))
    bind => [10364, 147, 10363]
Finest: Execute query UpdateObjectQuery(it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6})
Info: i.s.edea2.ejb.listener.UnitListener.preUpdateWithChanges[:55] - entity: it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Finest: Execute query InsertObjectQuery(it.shape.edea2.jpa.UnitRegistration@c1326ae5[null@null])
Fine: INSERT INTO UNIT_REGISTRATION (REG_DATE, VERSION, PERSON_ID, UNIT_ID) VALUES (?, ?, ?, ?)
    bind => [2015-05-21 18:24:58.099, 1, 2, 69545]
Finest: Execute query ValueReadQuery(name="GLOBAL_SEQUENCE" sql="SELECT LAST_INSERT_ID()")
Fine: SELECT LAST_INSERT_ID()
Finest: assign sequence to the object (207.728 -> it.shape.edea2.jpa.UnitRegistration@c1326ae5[null@1])
Finest: Execute query ReadAllQuery(name="registrationList" referenceClass=UnitRegistration sql="SELECT ID, REG_DATE, VERSION, PERSON_ID, UNIT_ID FROM UNIT_REGISTRATION WHERE (UNIT_ID = ?)")
Fine: SELECT ID, REG_DATE, VERSION, PERSON_ID, UNIT_ID FROM UNIT_REGISTRATION WHERE (UNIT_ID = ?)
    bind => [69545]
Finest: Register the existing object it.shape.edea2.jpa.Item@6a6dedd6[69545@3]{A1000|PI060060-09.80.60|WP 6.6}
Fine: UPDATE UNIT SET NAME = ?, UPDATED_ID = ?, VERSION = ? WHERE ((ID = ?) AND (VERSION = ?))
    bind => [WP 6.6 - SYSTEM SAFETY ASSESSMENT hhh, 207728, 4, 69545, 3]
Finest: Connection released to connection pool [default].
Finer: TX afterCompletion callback, status=COMMITTED
Finer: end unit of work commit
Finer: release unit of work
Finer: client released
Info: i.s.edea2.jsf.controller.EntityBean.setEntity[:211] - entity: it.shape.edea2.jpa.Item@6a6dedd6[69545@4]{A1000|PI060060-09.80.60|WP 6.6}
Info: i.s.edea2.jsf.controller.EntityBean.update[:127] - ========================> name: WP 6.6 - SYSTEM SAFETY ASSESSMENT hhh

这是persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="edea2" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>java:app/jdbc/edea2</jta-data-source>

        <class>it.shape.core.jpa.AbstractEntity</class>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>

        <properties>
            <property name="javax.persistence.jdbc.driver" value="${edea2.jdbc.driverClass}" />
            <property name="javax.persistence.jdbc.url" value="${edea2.jdbc.url}" />
            <property name="javax.persistence.jdbc.user" value="${edea2.jdbc.user}" />
            <property name="javax.persistence.jdbc.password" value="${edea2.jdbc.password}" />

            <property name="eclipselink.target-database" value="${edea2.eclipselink.targetDatabase}" />
            <property name="eclipselink.ddl-generation.index-foreign-keys" value="true" />
            <property name="eclipselink.logging.level" value="FINEST" />
            <property name="eclipselink.logging.level.sql" value="FINE"/>
            <property name="eclipselink.logging.parameters" value="true" />

            <property name="javax.persistence.schema-generation.database.action" value="none" />
        </properties>
    </persistence-unit>
</persistence>

我真的没有想法......

0 个答案:

没有答案