Hibernate在createQuery上发明了一个字段

时间:2016-02-09 10:55:57

标签: java oracle hibernate

我正在使用hibernate从数据库中获取数据。我有一个奇怪的问题。

我从数据库映射的实体没有名为“Id”的字段,也没有表。

但是当我执行这个查询时:

#include <ctime>
#include <iomanip>
#include <iostream>
#include <sstream>

// Converts UTC time string to a time_t value.
std::time_t getEpochTime(const std::wstring& dateTime)
{
   // Let's consider we are getting all the input in
   // this format: '2014-07-25T20:17:22Z' (T denotes
   // start of Time part, Z denotes UTC zone).
   // A better approach would be to pass in the format as well.
   static const std::wstring dateTimeFormat{ L"%Y-%m-%dT%H:%M:%SZ" };

   // Create a stream which we will use to parse the string,
   // which we provide to constructor of stream to fill the buffer.
   std::wistringstream ss{ dateTime };

   // Create a tm object to store the parsed date and time.
   std::tm dt;

   // Now we read from buffer using get_time manipulator
   // and formatting the input appropriately.
   ss >> std::get_time(&dt, dateTimeFormat.c_str());

   // Convert the tm structure to time_t value and return.
   return std::mktime(&dt);
}

我有一个例外:

Query query = em.createQuery("select d from MYTABLE d WHERE d.programId = :programID");
query.setParameter("programID", programID);
query.getResultList()

其他字段在表格和实体classe中,但字段ID已经发明。

你有什么想法吗?

由于

0 个答案:

没有答案