INSERT stmt を使用してデータベースにデータを直接挿入したいのですが、HQL は初めてです。次のコードを使用する場合: CompanyMaster はモデル名です( CompanyMaster.java )
public void insertCompanyData(CompanyMaster company) {
logger.info("Entering insertCompanyData");
Session session = null;
try{
session = getSession();
String hql = "INSERT INTO CompanyMaster (CompName,description,status) SELECT (company.getCompName(),company.getDescription(),company.getStatus())";
//String hql = "INSERT INTO CompanyMaster company(CompName,description,status) VALUES (company.getCompName(),company.getDescription(),company.getStatus())";
Query query = session.createQuery(hql);
//query.setString("groupId", groupId);
query.executeUpdate();
} finally{
releaseSession(session);
}
logger.info("Exiting insertCompanyData");
}
私はこのようなエラーが発生しています
2013-07-23 09:34:53 INFO [http-8080-2] CompanyDaoImpl.java:157 - Entering insertCompanyData
2013-07-23 09:34:53 ERROR [http-8080-2] ErrorCounter.java:56 - <AST>:0:0: unexpected end of subtree
2013-07-23 09:34:53 ERROR [http-8080-2] ErrorCounter.java:56 - <AST>:0:0: unexpected AST node: {vector}
2013-07-23 09:34:53 INFO [http-8080-2] CompanyMasterServiceImpl.java:121 - Entering buildCompanyMasterDropdowns ..
2013-07-23 09:34:53 INFO [http-8080-2] CodesDaoImpl.java:27 - Entering findCodesByType()
Hibernate: select this_.CODE_MASTER_ID as CODE1_8_0_, this_.CR_TS as CR2_8_0_, this_.CR_USR as CR3_8_0_, this_.MD_TS as MD4_8_0_, this_.MD_USR as MD5_8_0_, this_.CODE_ID as CODE6_8_0_, this_.CODE_MASTER_TYPE as CODE7_8_0_, this_.CODE_DESC as CODE8_8_0_, this_.STATUS as STATUS8_0_ from FBMS.MST_CODE this_ where this_.CODE_MASTER_TYPE=? and this_.STATUS=? order by this_.CODE_DESC asc
2013-07-23 09:34:53 INFO [http-8080-2] CodesDaoImpl.java:33 - Exiting findCodesByType() ..
このエラーを修正する方法を提案してください...