You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Adam Hardy (JIRA)" <ji...@apache.org> on 2008/03/09 20:15:47 UTC

[jira] Created: (OPENJPA-534) event listener not firing

event listener not firing
-------------------------

                 Key: OPENJPA-534
                 URL: https://issues.apache.org/jira/browse/OPENJPA-534
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.1.0
         Environment: Linux 2.6, jdk1.5.0_12, Derby
            Reporter: Adam Hardy


I have a superclass with several properties, including 'modified', a datetime field which a prepersistlistener should update.

All my entities inherit this superclass. 

The superclass is mapped with the appropriate prepersist listener identifying the callback method to call.


  <mapped-superclass class="org.permacode.atomic.domain.AtomicEntity"
    access="FIELD">
    <pre-persist method-name="prePersistCallBack" />
    <attributes>
      <basic name="ownerId">
        <column name="OWNER_ID" />
      </basic>
      <basic name="created">
        <column name="CREATED" />
        <temporal>DATE</temporal>
      </basic>
      <basic name="modified">
        <column name="MODIFIED" />
        <temporal>DATE</temporal>
      </basic>
      <version name="version">
        <column name="VERSION" />
      </version>
    </attributes>
  </mapped-superclass>


The method prePersistCallBack() is on the superclass:

    public void prePersistCallBack()
    {
        this.setModified(new Date());
        logger.info("doing prePersistCallBack()");
    }

I see no logging and I see the SQL statement contains the untouched modified value.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-534) event listener not firing

Posted by "Adam Hardy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Hardy resolved OPENJPA-534.
--------------------------------

    Resolution: Invalid

False alarm. 

It is the pre-update listener that fires in this case, rather than the prepersist. 



> event listener not firing
> -------------------------
>
>                 Key: OPENJPA-534
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-534
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>         Environment: Linux 2.6, jdk1.5.0_12, Derby
>            Reporter: Adam Hardy
>         Attachments: jpabug.zip
>
>
> I have a superclass with several properties, including 'modified', a datetime field which a prepersistlistener should update.
> All my entities inherit this superclass. 
> The superclass is mapped with the appropriate prepersist listener identifying the callback method to call.
>   <mapped-superclass class="org.permacode.atomic.domain.AtomicEntity"
>     access="FIELD">
>     <pre-persist method-name="prePersistCallBack" />
>     <attributes>
>       <basic name="ownerId">
>         <column name="OWNER_ID" />
>       </basic>
>       <basic name="created">
>         <column name="CREATED" />
>         <temporal>DATE</temporal>
>       </basic>
>       <basic name="modified">
>         <column name="MODIFIED" />
>         <temporal>DATE</temporal>
>       </basic>
>       <version name="version">
>         <column name="VERSION" />
>       </version>
>     </attributes>
>   </mapped-superclass>
> The method prePersistCallBack() is on the superclass:
>     public void prePersistCallBack()
>     {
>         this.setModified(new Date());
>         logger.info("doing prePersistCallBack()");
>     }
> I see no logging and I see the SQL statement contains the untouched modified value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-534) event listener not firing

Posted by "Adam Hardy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Hardy updated OPENJPA-534:
-------------------------------

    Attachment: jpabug.zip

All the dependencies are in target/dependency.

It's set up with H2 

The test creates a new database, creates a table, and inserts a row.

Then it launches openJpa and retrieves the entity mapped to the row. 

It modifies the entity and persists it. 

A quick test shows that the callback was not fired. 

> event listener not firing
> -------------------------
>
>                 Key: OPENJPA-534
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-534
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>         Environment: Linux 2.6, jdk1.5.0_12, Derby
>            Reporter: Adam Hardy
>         Attachments: jpabug.zip
>
>
> I have a superclass with several properties, including 'modified', a datetime field which a prepersistlistener should update.
> All my entities inherit this superclass. 
> The superclass is mapped with the appropriate prepersist listener identifying the callback method to call.
>   <mapped-superclass class="org.permacode.atomic.domain.AtomicEntity"
>     access="FIELD">
>     <pre-persist method-name="prePersistCallBack" />
>     <attributes>
>       <basic name="ownerId">
>         <column name="OWNER_ID" />
>       </basic>
>       <basic name="created">
>         <column name="CREATED" />
>         <temporal>DATE</temporal>
>       </basic>
>       <basic name="modified">
>         <column name="MODIFIED" />
>         <temporal>DATE</temporal>
>       </basic>
>       <version name="version">
>         <column name="VERSION" />
>       </version>
>     </attributes>
>   </mapped-superclass>
> The method prePersistCallBack() is on the superclass:
>     public void prePersistCallBack()
>     {
>         this.setModified(new Date());
>         logger.info("doing prePersistCallBack()");
>     }
> I see no logging and I see the SQL statement contains the untouched modified value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.