eclipselink - Unable to run native JPA queries in testEntityManager container -


Note: I posted this question on the eclipse forum but I did not get any response, although I thought the problem description Was clear enough

I'm posting it here. If someone can help, then it would be great.

I have a JPA unit class on which the table does not support it in the database. We made it only because we needed to run a query that was necessary to be included in several tables. So instead of creating a named query, we went through the original query mode to improve the speed. We have a JPA unit like:

  @intexty @ SQLRetsSetmapping (name = "usermapping", entities = @entiarcelt (Entity Class = user class)) @ Enrolled Technology (name = "User. Public query user {}  

Now it runs fine with a unit manager object such as: em.createNamedQuery (query) "query", query = "- original query here -", resulting in nmentation = "User Mapping") ("User.query") Set parameter ("sub .org), Ultimate) .getResultList ();

But when it is tested with Testng inside a unit manager container environment (built with EntityManagerFactory), the 0RA-942 table or view does not exist The error is thrown away. We tried to enable use_native_sql = true in persistence.properties and SessionCustomizer.

We use eclipselink JPA

Can help with some feedback?

thanks

come Clues to solving the ripe problem can be the structure of your original query.

I tested the case of simple access to the mapped unit with the original query named Eclipselink 2.5.1 and it works great. The code I am using is like this (table EMPLOYEE exists in embedded DB, table USER is not).

  @Entity Public Class Employee {@Id @GeneratedValue int id; } @ Entity @ SQLRSUITSetMapping (named = "User Mapping", Entities = EntityResult (entityClass = User.class)) @ Nominated (name = "User.query", query = "Select ID" \ "user \", resultSetMapping = "User Mapping") Public Class User {@Id @GeneratedValue int id; }  

This code is successfully executed with the named query and the number of results displayed in the EMPLOYEE table, however if I change the country query to use the USER table, then I Is happening in any way

  SQLSyntaxErrorException: table / view 'user' does not exist  

Maybe you have asked your question of that name Updating with the query that you are using and confirming it To do that the table was not present, this is the case.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -