我正在使用 eclipselink 实现一个 JPA 应用程序,但是每当我运行该应用程序时,它都会引发以下异常
例外:
[EL 严重]:ejb:2013-06-24 14:11:05.079--ServerSession(1867873711)--java.lang.UnsupportedOperationException
持久化.xml
<property name="javax.persistence.jdbc.password" value="test"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/test"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.logging.level" value="INFO"/>
联系:
public void init(ServletConfig config) throws ServletException {
Connection connection = null;
System.out.println("calling intizlaing method");
try {
System.out.println("starat intizlaing context");
InitialContext ctx = new InitialContext();
System.out.println("done context");
ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DefaultDB");
System.out.println("start intialising ds");
connection = ds.getConnection();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, ds);
String databaseProductName = connection.getMetaData()
.getDatabaseProductName();
if (databaseProductName.equals("HDB")) {
properties.put("eclipselink.target-database",
"com.sap.persistence.platform.database.HDBPlatform");
}
emf = Persistence.createEntityManagerFactory(
"db", properties);
System.out.println("got EntityManagerFactory");
em = emf.createEntityManager();
System.out.println("calling intizlaing finisged method");
} catch (NamingException e) {
System.out.println(e.toString());
throw new ServletException(e);
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println(e.toString());
}