问题描述
我上课有2种方法。
通过调用第一个方法,我正在将数据插入GTT(Global temporary table)
中。插入数据后,我将通过调用another method
从GTT读取数据来创建文件。但是我没有任何数据。如果您退出方法,session
是否会关闭?意味着如果您要通过调用一个方法在GTT中插入数据,那么我不会在另一种方法中获得同一表的数据。 Java有可能吗?由于数据库中已有体系结构,因此我必须使用GTT。
我正在通过以下方法将数据插入GTT。
public int insertDataToGTT(String p_entity_name,String p_update_mode) throws Exception
{
CallableStatement statement =
connection.prepareCall("{call update_dynamic_entity_NEW(?,?)}");
statement.setString(1,p_entity_name);
statement.setString(2,p_update_mode);
int numberOFRows=statement.executeUpdate();
return numberOFRows;
}
`update_dynamic_entity_NEW` procedure inserts data into `dynamicentitygtt` table.
public String createJsonFile(String dynamicEntityName) throws Exception
{
String query="select * from dynamicentitygtt";
PreparedStatement prepstatement=connection.prepareStatement(query);
ResultSet rs=prepstatement.executeQuery();
while(rs.next())
{
//I am reading data here. But query is not returning any rows.
}
如果我在一种方法中插入数据并在GTT中用同一类的另一种方法读取数据,是否仍然存在。
我的GTT是on commit preserve rows.
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)