Hi all, What's wrong with this code : public class testsynchro { public static void main(String [] args) throws XWikiException, HibernateException { XWikiContext context = new XWikiContext(); context.setDatabase("xwiki"); context.setUser("XWiki.superadmin"); XWikiConfig config = new XWikiConfig(); config.put("xwiki.store.class", "com.xpn.xwiki.store.XWikiHibernateStore"); config.put("xwiki.store.hibernate.path", "/var/lib/tomcat4/webapps/xwiki/WEB-INF/hibernate.cfg.xml"); XWiki xwiki = new XWiki(config, context); context.setWiki(xwiki); HashMap map = new HashMap(); map.put("password", "toto"); xwiki.createUser("toto", map, "", "", "edit", context); } } TOTO is created, but it gives me always error : - Error performing load command org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xpn.xwiki.objects.classes.BaseClass#-905821124] at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:118) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:167) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:79) at org.hibernate.impl.SessionImpl.load(SessionImpl.java:588) at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiClass(XWikiHibernateStore.java:1194) at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:589) at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:123) at com.xpn.xwiki.XWiki.getDocument(XWiki.java:565) at com.xpn.xwiki.XWiki.getDocument(XWiki.java:599) at com.xpn.xwiki.XWiki.createUser(XWiki.java:1764) at testsynchro.main(testsynchro.java:49) thanx ! ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com
Hi, maybe you forget some parameters on your map. Give a look to http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xwiki/xwiki/trunk/src/mai... in the function : public int createUser(boolean withValidation, String userRights, XWikiContext context) throws XWikiException Jérémi On 6/20/06, Vincent Stoeckel <v.stoeckel@free.fr> wrote:
Hi all,
What's wrong with this code :
public class testsynchro { public static void main(String [] args) throws XWikiException, HibernateException {
XWikiContext context = new XWikiContext(); context.setDatabase("xwiki"); context.setUser("XWiki.superadmin");
XWikiConfig config = new XWikiConfig(); config.put("xwiki.store.class", "com.xpn.xwiki.store.XWikiHibernateStore"); config.put("xwiki.store.hibernate.path", "/var/lib/tomcat4/webapps/xwiki/WEB-INF/hibernate.cfg.xml");
XWiki xwiki = new XWiki(config, context); context.setWiki(xwiki);
HashMap map = new HashMap(); map.put("password", "toto"); xwiki.createUser("toto", map, "", "", "edit", context); } }
TOTO is created, but it gives me always error :
- Error performing load command org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xpn.xwiki.objects.classes.BaseClass#-905821124] at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:118) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:167) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:79) at org.hibernate.impl.SessionImpl.load(SessionImpl.java:588) at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiClass(XWikiHibernateStore.java:1194) at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:589) at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:123) at com.xpn.xwiki.XWiki.getDocument(XWiki.java:565) at com.xpn.xwiki.XWiki.getDocument(XWiki.java:599) at com.xpn.xwiki.XWiki.createUser(XWiki.java:1764) at testsynchro.main(testsynchro.java:49)
thanx !
___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com
-- You receive this message as a subscriber of the xwiki-dev@objectweb.org mailing list. To unsubscribe: mailto:xwiki-dev-unsubscribe@objectweb.org For general help: mailto:sympa@objectweb.org?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- jeremi
thanx but the problem seems to be in the function : getDocument(XWikiDocument, XWikiContext) in createUser(xwikiname, ....) Maybe I've some missing parameters in XWikiContext, but i dont know how to init it correctly, is there any examples somewhere ? ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com
participants (2)
-
jeremi joslin -
Vincent Stoeckel