You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by GESCONSULTOR - Óscar Bou <o....@gesconsultor.com> on 2013/06/05 12:43:17 UTC

Custom Queries - or Accessing the JDO PersistenceManager

Hi to all.

We need to implement generic JDO repositories with methods for our UI like "findByDatabaseId(String Id)" etc.

Also, there's sometimes the need to be able to "compose" a query as a string instead of using one pre-declared on a Class with the JDO @Queries annotation (for example, for dinamically specify additional filters on the WHERE clause).

The current Apache Isis Query API does not allow tho execute queries defined as String.

What's the better way to access the JDO Persistence Manager used by Isis? Is there an Apache Isis API that we are missing?

Thanks in advance!




Re: Custom Queries - or Accessing the JDO PersistenceManager

Posted by GESCONSULTOR - Óscar Bou <o....@gesconsultor.com>.
Thanks a lot, Dan, for the quick response and the helpful patch.

We will try it later.

In the meantime I've created the ticket:

https://issues.apache.org/jira/browse/ISIS-422


We are currently prototyping the integration of the IsisSystem on Wavemaker, using as an example the Wicket implementation. We are trying to resolve some doubts. I will post on a new thread what we are seeing and trying as it can be helpful to clarify it for all those needing to integrate Isis for custom views etc. on their current platforms.


Thanks again,

Oscar





El 05/06/2013, a las 12:54, Dan Haywood <da...@haywood-associates.co.uk> escribió:

> Not supported yet.  Could you raise a ticket?
> 
> In the meantime, you can easily patch Isis yourself.
> 
> Take a copy of IsisJdoSupport and IsisJdoSupportImpl.
> 
> In IsisJdoSupport, add:
> 
> PersistenceManager getJdoPersistenceManager();
> 
> 
> In IsisJdoSupportImpl, add:
> 
> public PersistenceManager getJdoPersistenceManager() {
>    return getObjectStore().getPersistenceManager();
> }
> 
> protected DataNucleusObjectStore getObjectStore() {
>    return (DataNucleusObjectStore)
> getPersistenceSession().getObjectStore();
> }
> 
> 
> Then register this as a service and inject into your repositories etc.
> 
> ~~~
> Related, we have a sketchy plan to integrate Lucene into Isis.  Then a lot
> of these adhoc queries may just disappear as a requirement.
> 
> Cheers
> Dan
> 
> 
> 
> On 5 June 2013 11:43, GESCONSULTOR - Óscar Bou <o....@gesconsultor.com>wrote:
> 
>> 
>> Hi to all.
>> 
>> We need to implement generic JDO repositories with methods for our UI like
>> "findByDatabaseId(String Id)" etc.
>> 
>> Also, there's sometimes the need to be able to "compose" a query as a
>> string instead of using one pre-declared on a Class with the JDO @Queries
>> annotation (for example, for dinamically specify additional filters on the
>> WHERE clause).
>> 
>> The current Apache Isis Query API does not allow tho execute queries
>> defined as String.
>> 
>> What's the better way to access the JDO Persistence Manager used by Isis?
>> Is there an Apache Isis API that we are missing?
>> 
>> Thanks in advance!
>> 
>> 
>> 
>> 


Re: Custom Queries - or Accessing the JDO PersistenceManager

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Not supported yet.  Could you raise a ticket?

In the meantime, you can easily patch Isis yourself.

Take a copy of IsisJdoSupport and IsisJdoSupportImpl.

In IsisJdoSupport, add:

PersistenceManager getJdoPersistenceManager();


In IsisJdoSupportImpl, add:

public PersistenceManager getJdoPersistenceManager() {
    return getObjectStore().getPersistenceManager();
}

protected DataNucleusObjectStore getObjectStore() {
    return (DataNucleusObjectStore)
getPersistenceSession().getObjectStore();
}


Then register this as a service and inject into your repositories etc.

~~~
Related, we have a sketchy plan to integrate Lucene into Isis.  Then a lot
of these adhoc queries may just disappear as a requirement.

Cheers
Dan



On 5 June 2013 11:43, GESCONSULTOR - Óscar Bou <o....@gesconsultor.com>wrote:

>
> Hi to all.
>
> We need to implement generic JDO repositories with methods for our UI like
> "findByDatabaseId(String Id)" etc.
>
> Also, there's sometimes the need to be able to "compose" a query as a
> string instead of using one pre-declared on a Class with the JDO @Queries
> annotation (for example, for dinamically specify additional filters on the
> WHERE clause).
>
> The current Apache Isis Query API does not allow tho execute queries
> defined as String.
>
> What's the better way to access the JDO Persistence Manager used by Isis?
> Is there an Apache Isis API that we are missing?
>
> Thanks in advance!
>
>
>
>