Adding an Event listener to entity BlogEntryItem

12 views
Skip to first unread message

ferjon

unread,
Oct 30, 2010, 11:57:35 AM10/30/10
to xaloon
Hi,

Using the project structure of xaloon, how would I chain my event
listener (hibernate entity event listener) declared in the start-up
project's infrastructure context to xaloon wickets jpa entity?

Do you know how I could work around this? Other suggestions are
highly appreciated.


Thanks,

Vytautas

unread,
Oct 30, 2010, 2:59:14 PM10/30/10
to xaloon
Hi,
i am not sure, but maybe this might help you:
6.3. XML definition

this section says that xml descriptors may override JPA annotations.


http://docs.jboss.org/hibernate/entitymanager/3.5/reference/en/html/listeners.html

Also you may create JIRA issue with your requirements for version 1.5
at http://www.xaloon.org/jira

ferjon

unread,
Oct 30, 2010, 10:30:12 PM10/30/10
to xaloon
Hi,

Thanks for the reply.

I'm currently trying out orm.xml to be embedded in the
persistence.xml.

This is how it is configured:

<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
orm_1_0.xsd"
version="1.0">

<entity class="org.xaloon.wicket.component.blog.BlogEntryItem">
<entity-listeners>
<entity-listener class=<Your Event Listener here...>">
<post-persist method-name="onPostInsert" />
</entity-listener>
</entity-listeners>
</entity>
</entity-mappings>

and adding it to:

<?xml version="1.0" encoding="windows-1257" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="site">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<mapping-file>classpath:META-INF/orm.xml</mapping-file>
<class>org.xaloon.wicket.component.blog.BlogEntryItem</class>
<properties>
...
</properties>
</persistence-unit>
</persistence>


I was able to run the web app but whenever I create a new blog entry
this method is not called.

I'm actually basing my orm setup from a openjpa reference, i don't
know if hibernate doesn't support this.

ferjon

unread,
Oct 31, 2010, 11:56:59 AM10/31/10
to xaloon
This seems like the wrong concern.

It shouldn't be BlogEntryItem from jpa but the saving to repository.

I'm not quite acquianted yet with jcr, Could you point me to some
reference for adding event listener to a content repository
particularly to jackrabbit


TIA,

Vytautas

unread,
Oct 31, 2010, 2:16:17 PM10/31/10
to xaloon
There are two solutions to use blogging in xaloon:
a) using JPA (store blog in database);
b) using JCR (store blog in JCR repository);

Neither first one nor second one provides availability of event
listeners in current implementations.
I am curious what specific actions do you need? add additional
information? on form submit perform additional actions?

ferjon

unread,
Oct 31, 2010, 9:33:21 PM10/31/10
to xaloon
I'm having problems using JPA for storing blog after removing xaloon-
*repository-blog from web xml. This made me decide to just use the
JCR.

I just want to get a callback if a blog is successfully saved through
the event listener. From here, I could call my manager class to do the
necessary action in the front-end.
Having received the event by the manager, this will perform an
asynchronous call to my wicket component.

Reply all
Reply to author
Forward
0 new messages