public class Session extends Object implements Serializable, AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static Map<Class<?>,com.vesoft.nebula.client.graph.net.Session.Setter> |
COMPLEX_TYPE_AND_SETTER
some value setter for java type (complex java type include collections or date) that need
convert to NValue
|
static Map<Class<?>,com.vesoft.nebula.client.graph.net.Session.Setter> |
LEAF_TYPE_AND_SETTER
some value setter for java type (basic or nebula special type) that need convert to NValue
|
| Constructor and Description |
|---|
Session(SyncConnection connection,
AuthResult authResult,
NebulaPool connPool,
Boolean retryConnect)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
ResultSet |
execute(String stmt)
Execute the nGql sentence.
|
String |
executeJson(String stmt)
Execute the nGql sentence.
|
String |
executeJsonWithParameter(String stmt,
Map<String,Object> parameterMap)
Execute the nGql sentence.
|
ResultSet |
executeWithParameter(String stmt,
Map<String,Object> parameterMap)
Execute the nGql sentence.
|
HostAddress |
getGraphHost()
Gets the service address of the current connection
|
long |
getSessionID()
get SessionID
|
boolean |
ping()
Check current connection is ok
|
boolean |
pingSession()
check current session is ok
|
void |
release()
Notifies the server that the session is no longer needed
and returns the connection to the pool,
and the connection will be reuse.
|
static Value |
value2Nvalue(Object value)
convert java value type to nebula thrift value type
|
public static Map<Class<?>,com.vesoft.nebula.client.graph.net.Session.Setter> LEAF_TYPE_AND_SETTER
public Session(SyncConnection connection, AuthResult authResult, NebulaPool connPool, Boolean retryConnect)
connection - the connection from the poolauthResult - the auth result from graph serviceconnPool - the connection poolretryConnect - whether to retry after the connection is disconnectedpublic ResultSet execute(String stmt) throws IOErrorException
stmt - The nGql sentence.
such as insert ngql `INSERT VERTEX person(name) VALUES "Tom":("Tom");`IOErrorExceptionpublic ResultSet executeWithParameter(String stmt, Map<String,Object> parameterMap) throws IOErrorException
stmt - The nGql sentence.
such as insert ngql `INSERT VERTEX person(name) VALUES "Tom":("Tom");`parameterMap - The nGql parameter mapIOErrorExceptionpublic String executeJson(String stmt) throws IOErrorException
stmt - The nGql sentence.
such as insert ngql `INSERT VERTEX person(name) VALUES "Tom":("Tom");`
parameterMap The nGql parametersIOErrorExceptionpublic String executeJsonWithParameter(String stmt, Map<String,Object> parameterMap) throws IOErrorException
stmt - The nGql sentence.
such as insert ngql `INSERT VERTEX person(name) VALUES "Tom":("Tom");`
parameterMap The nGql parametersIOErrorExceptionpublic boolean ping()
public boolean pingSession()
public void release()
public HostAddress getGraphHost()
public long getSessionID()
public static Value value2Nvalue(Object value) throws UnsupportedOperationException
value - java objUnsupportedOperationExceptionpublic void close()
close in interface AutoCloseableCopyright © 2023. All rights reserved.