Page 1 of 1
INSERT into openkm Database tables from java codes
PostPosted:Thu Aug 02, 2018 5:48 am
by mamad
Hi guys,
According to what I have read in openKM documentation, we cant insert into our own tables from java codes(and only can exceute UPDATE,DELETE and SELECT queries), i mean we can execute Inserting queries only by executing them in "Database query" menu in openKM or do it straightly inside Mysql workbench.
Is there any any way to execute INSERT queries in our codes ?
Re: INSERT into openkm Database tables from java codes
PostPosted:Fri Aug 03, 2018 6:57 pm
by jllort
I think LegacyDAO might be your class
https://docs.openkm.com/kcenter/view/ok ... cydao.html where you also might executing inserts ( also you can execute inserts from Administration > Database query )
Re: INSERT into openkm Database tables from java codes
PostPosted:Sat Aug 04, 2018 7:44 am
by mamad
thanks it works for non-GWT classes.
But what about GWT based classes ? i dont see any example of using INSERT query in documentation.
Please consider that i know about Administration > Database query but i want to do INSERTING in my code (for some dynamic purposes)
Re: INSERT into openkm Database tables from java codes
PostPosted:Sat Aug 04, 2018 3:33 pm
by jllort
GWT classes always interact with the application across Servlet, for example take a look at these classes:
com.openkm.servlet.frontend.DocumentServlet -> Where the servlet makes calls to the core
com.openkm.frontend.client.service.OKMDocumentService -> interface defininition
com.openkm.frontend.client.service.OKMDocumentServiceAsync -> where GWT classes make call for accessing the servlet exposed methods
Re: INSERT into openkm Database tables from java codes
PostPosted:Mon Aug 06, 2018 4:40 am
by mamad
well, i read this classes but would you please share me a simple example about how to use this classes ? Is there any part in openkm-CE documentation that has some practical examples about using Servlets ?
Re: INSERT into openkm Database tables from java codes
PostPosted:Tue Aug 07, 2018 7:26 am
by jllort
Servlets are exposed with a declaration into web.xml , take a look into. This is a JAVA standard architecture, not an OpenKM exclusive one, basically, we do not have documentation about something that you should previously know about how building JAVA applications with Servlets. This might try to give you some clues about how doing it. We have a Servlet named com.openkm.servlet.frontend.TestServlet I suggest take it as a reference and create your own.
Re: INSERT into openkm Database tables from java codes
PostPosted:Wed Aug 08, 2018 8:51 pm
by mamad
OK, thank you so much