On 05/18/2015 02:03 PM, Chuangyu wrote:
Dan,
Ok, I will try type-safe queries.
You could do:

TypesafeQuery<DomainClass> tq = ((JDOPersistenceManager) isisJdoSupport.getJdoPersistenceManager()).newTypesafeQuery(DomainClass.class);
QDomainClass cand = QDomainClass.candidate();
Long numberOfResults = (Long)tq.executeResultUnique(true, cand.count());

Erik

Thanks for your support.

Rgards,

James.

2015-05-16 19:23 GMT+08:00 Dan Haywood <[email protected]>:

Another option is to use DataNucleus' type-safe queries.  I just recently
started playing around with these; the isisaddons' todoapp shows an example
[1]

The main thing you need to ensure is that your IDE has annotation
processing enabled.  IntelliJ does this automatically, so does Eclipse I
think, so it should probably "just work".  It requires:

                 <dependency>
                     <groupId>org.datanucleus</groupId>
                     <artifactId>datanucleus-api-jdo</artifactId>
                 </dependency>

to be in your classpath of the dom module (this is where the annotation
processor implementation is, I believe).

Cheers
Dan


[1]

https://github.com/isisaddons/isis-app-todoapp/blob/master/dom/src/main/java/todoapp/dom/module/todoitem/ToDoItemRepositoryImplUsingTypesafeQueries.java#L37

On 15 May 2015 at 05:28, Chuangyu <[email protected]> wrote:

Oh ,I find the IsisJdoSupportService.

2015-05-15 12:17 GMT+08:00 Chuangyu <[email protected]>:

Hi,

I tried to find query  aggregate values use JDOQL ,but
DomainObjectContainer seems not support that?

all methods returns  <T>  or List<T>, but cannot return a Integer.

for example :

@javax.jdo.annotations.Query(
name="countAll",language = "JDOQL",
value = "SELECT count(this)"
+ "FROM dom.SimpleObject"
)


Thanks

James


Reply via email to