Re: [xwiki-users] Fw : Fw : Re: Fw : Re: Fw : Re: How can I get event object through a form
On Wed, Jan 20, 2016 at 6:33 PM, Pascal BASTIEN wrote: > Thxs => useful links bookmarked :-) > > Anyway, how do you found default alias of table name then? > By example the alias "act" in my hql string here "act.eventId" (I found it > by chance in error log) > #set($results= $xwiki.activitystream.searchEvents("act.eventId in > ($ListIn)", false, 0, 0)) > > Here i suppose? > https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/java/com/xpn/xwiki/plugin/activitystream/impl/ActivityStreamImpl.java#L429-L430 > > Yes. The API is not optimal, I agree, and it was not really improved along the years. Thanks, Eduard > > > ---- > En date de : Mer 20.1.16, Eduard Moraru a écrit : > > Objet: Re: [xwiki-users] Fw : Fw : Re: Fw : Re: Fw : Re: How can I get > event object through a form > À: "Pascal BASTIEN" , "XWiki Users" < > users@xwiki.org> > Date: Mercredi 20 janvier 2016, 16h36 > > Hi, > > This is the activitystream hibernate > mapping where you can see the exact property names: > > https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/activitystream.hbm.xml > > ...and this is the > regular XWiki model mapping (corresponding to the other > tables observed in > http://platform.xwiki.org/xwiki/bin/view/DevGuide/DatabaseSchema > ) > > https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/xwiki.hbm.xml > > Remember that, when > writing HQL, you need to look at the hibernate mapping, not > just the SQL database schema (which is useful, but can be > misleading). > > Thanks, > Eduard > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Fw : Fw : Re: Fw : Re: Fw : Re: How can I get event object through a form
Thxs => useful links bookmarked :-) Anyway, how do you found default alias of table name then? By example the alias "act" in my hql string here "act.eventId" (I found it by chance in error log) #set($results= $xwiki.activitystream.searchEvents("act.eventId in ($ListIn)", false, 0, 0)) Here i suppose? https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/java/com/xpn/xwiki/plugin/activitystream/impl/ActivityStreamImpl.java#L429-L430 En date de : Mer 20.1.16, Eduard Moraru a écrit : Objet: Re: [xwiki-users] Fw : Fw : Re: Fw : Re: Fw : Re: How can I get event object through a form À: "Pascal BASTIEN" , "XWiki Users" Date: Mercredi 20 janvier 2016, 16h36 Hi, This is the activitystream hibernate mapping where you can see the exact property names: https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/activitystream.hbm.xml ...and this is the regular XWiki model mapping (corresponding to the other tables observed in http://platform.xwiki.org/xwiki/bin/view/DevGuide/DatabaseSchema ) https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/xwiki.hbm.xml Remember that, when writing HQL, you need to look at the hibernate mapping, not just the SQL database schema (which is useful, but can be misleading). Thanks, Eduard ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Fw : Fw : Re: Fw : Re: Fw : Re: How can I get event object through a form
Hi, This is the activitystream hibernate mapping where you can see the exact property names: https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/activitystream.hbm.xml ...and this is the regular XWiki model mapping (corresponding to the other tables observed in http://platform.xwiki.org/xwiki/bin/view/DevGuide/DatabaseSchema ) https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/xwiki.hbm.xml Remember that, when writing HQL, you need to look at the hibernate mapping, not just the SQL database schema (which is useful, but can be misleading). Thanks, Eduard On Wed, Jan 20, 2016 at 9:27 AM, Pascal BASTIEN wrote: > Ok thxs guys > I didn't understood why my $xwiki.activitystream.searchEvents doesn't work > with eventid... > > I'm starting to begin some help and copy/paste > Doc http://platform.xwiki.org/xwiki/bin/view/DevGuide/DatabaseSchema > indicate: > "In a hibernate query you can use the same name as the get method but > without the get and with the first letter lowercase so the SQL query" > > I drink a strong coffe and read ... WITH THE FIRST LETTER LOWERCASE! > > Then I replace my EventId by eventId to fix my ugly code (because public > String getEventId()): > #set($results= > $xwiki.activitystream.searchEvents("act.eventId='$MyValue'", false, 0, 0)) > and tad! > it's working thxs a lot. > I will post my form here later when it will be ready if you want it. :-) > > > > $xwiki.activitystream.method but if I use where condition on > > eventid field I obtain this error :-( > > > > > > Caused by: org.hibernate.QueryException: could not resolve > > property: EventId of: > > com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl > > [select act from > > com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl > > as act where > > act.EventId='757328280-1453216488000-dishFheu' order by > > act.date desc] > > at > > > org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:81) > > > > > ___ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Fw : Fw : Re: Fw : Re: Fw : Re: How can I get event object through a form
Ok thxs guys I didn't understood why my $xwiki.activitystream.searchEvents doesn't work with eventid... I'm starting to begin some help and copy/paste Doc http://platform.xwiki.org/xwiki/bin/view/DevGuide/DatabaseSchema indicate: "In a hibernate query you can use the same name as the get method but without the get and with the first letter lowercase so the SQL query" I drink a strong coffe and read ... WITH THE FIRST LETTER LOWERCASE! Then I replace my EventId by eventId to fix my ugly code (because public String getEventId()): #set($results= $xwiki.activitystream.searchEvents("act.eventId='$MyValue'", false, 0, 0)) and tad! it's working thxs a lot. I will post my form here later when it will be ready if you want it. :-) > $xwiki.activitystream.method but if I use where condition on > eventid field I obtain this error :-( > > > Caused by: org.hibernate.QueryException: could not resolve > property: EventId of: > com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl > [select act from > com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl > as act where > act.EventId='757328280-1453216488000-dishFheu' order by > act.date desc] > at > org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:81) > > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users