In the 2º function when tries to run the command sql, give exception:
Database is closed
El jueves, 24 de noviembre de 2016, 12:05:38 (UTC+1), Ivan Mainetti
escribió:
>
> could you post the exception?
> which part of the code throws it?
>
>
> Il giorno giovedì 24 novembre 2016 11:04:08 UTC+1, Academia Learning
> Centro de inglés y de formación ha scritto:
>>
>> Hello I wanted to ask if I am doing this correctly or am doing something
>> wrong, I initialize it like this:
>> *Class orientDBService*
>> OrientGraphFactory oFactory = new OrientGraphFactory
>> (this.databaseURI).setupPool(1,10);;
>> this.graph = oFactory.getTx();
>>
>>
>> Then I have two methods one to create a Vertex and another to recover it
>> public void insertComposition(EhrId ehrId, CompositionData
>> compositionData) {
>> OrientGraph graph = orientDBService.getGraph();
>> try{
>> Vertex compositionVersion = (Vertex) graph.command( new
>> OCommandSQL("insert into CompositionVersions set value = " +
>> compositionData.asJSON()) ).execute();
>>
>> }catch( Exception e ) {
>> graph.rollback();
>> }finally {
>> graph.shutdown();
>> }
>> }
>>
>>
>> recover function
>> public CompositionData getComposition(String compositionId) {
>> OrientGraph graph = orientDBService.getGraph();
>> Vertex composition = null;
>> try{
>> Iterable<OrientVertex> resultComposition = graph
>> .command( new OCommandSQL("SELECT expand (out('hasVersions')) as
>> this FROM Composition WHERE idComposition = "5") ).execute();
>> if (resultComposition.iterator().hasNext()){
>> composition = (Vertex) resultComposition.iterator().next();
>> }
>>
>> }catch( Exception e ) {
>> graph.rollback();
>> }finally {
>> graph.shutdown();
>> }
>>
>> return
>> CompositionData.fromJSON(composition.getProperty("this").toString());
>> }
>>
>>
>>
>> *This gives me the exception: Database is closed, However if I do not use
>> graph.shutdown the data is not yet persistent*
>>
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.