0

我最近正在帮助使用 H2 数据库测试 Java 服务。我使用的 H2 设置是服务器模式,我的网址是"jdbc:h2:tcp://localhost/~/test;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=-1;MODE=MySQL;"

我意识到加载 mysql 架构时存在一些问题,所以我按照这个介绍(http://matthewcasperson.blogspot.com/2013/07/exporting-from-mysql-to-h2.html)和人们在stackoverflow中的讨论修改我从 MySQL 转储的架构。

当我将一个人/客户添加到表中时,Java 服务中的 HttpPost 似乎很好。我还可以在 H2 控制台中看到正在创建的客户。但是,当我尝试使用 HttpGet 检索客户数据时,我收到了以下错误消息:

    {"message":"Column \"APPS0_.DEBUGGING\" not found; SQL statement:\n/* load one-to-many 
com.prduct.reward.db.Customer.apps */ select apps0_.customer_id as customer18_6_1_, apps0_.id as 
id3_1_, apps0_.id as id3_0_, apps0_.app_install_count as app2_3_0_, apps0_.app_key as app3_3_0_, 
apps0_.app_store_type as app4_3_0_, apps0_.app_store_live as app5_3_0_, apps0_.app_store_url as 
app6_3_0_, apps0_.create_date as create7_3_0_, apps0_.customer_id as customer18_3_0_, 
apps0_.debugging as debugging3_0_, apps0_.deleted as deleted3_0_, apps0_.icon_url as icon10_3_0_, 
apps0_.name as name3_0_, apps0_.os_type as os12_3_0_, apps0_.os_version_max as os13_3_0_, 
apps0_.os_version_min as os14_3_0_, apps0_.sdk_integration_info as sdk15_3_0_, apps0_.secret as 
secret3_0_, apps0_.update_date as update17_3_0_ from App apps0_ where apps0_.customer_id=? [42122-
174]","code":400}

我不明白的部分是源代码或任何创建的表都没有调试列。

我检索客户的代码是

public JSONObject retrieveCustomer() throws Exception { 
    String postUrl = http://localhost:8182/service/customer/customerKey;
    Client client = Client.create();
    WebResource webResource = client.resource(postUrl);
    final HTTPBasicAuthFilter authFilter = new HTTPBasicAuthFilter(adminLogin, adminpwd);
    client.addFilter(authFilter);
    ClientResponse response = webResource.accept("application/json").get(ClientResponse.class);
    jsonResp = new JSONObject(response.getEntity(String.class));
    System.out.println(jsonResp02);
    return jsonResp;
}

Java服务连接到H2(url:jdbc:h2:tcp://localhost/~/test),HTTP服务器监听服务请求是通过8182端口。

有人可以建议我如何处理这个问题吗?这两天我一直在四处寻找,但仍然找不到解决方案。谢谢你的帮助!

4

0 回答 0