开发者

Exception in inserting data into data using JPA in netbeans

SEVERE: Local Exception Stack:
Exception [EclipseLink-7092] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): 
            org.eclipse.persistence.exceptions.Valida开发者_如何学JAVAtionException
Exception Description: Cannot add a query whose types conflict with an existing query. 
    Query To Be Added: [ReadAllQuery(name="Voter.findAll" referenceClass=Voter 
    jpql="SELECT v FROM Voter v")] is named: [Voter.findAll] with arguments [[]].
    The existing conflicting query: [ReadAllQuery(name="Voter.findAll" referenceClass=
    Voter jpql="SELECT v FROM Voter v")] is named: [Voter.findAll] with arguments: [[]].


I too have come across this issue and it makes little sense. I only have one entity bean with one defined query, and it continues to tell me it's the problem. I did a stop, then start of GF3, redploy my app, and I still get it.. and worse, I am not even using the query.

One thing I don't understand.. why is EclipseLink being used in GF? Is that part of GF? I use Eclipse IDE, but I don't deploy from within Eclipse.. I deploy from my ant build script at command line. I am guessing GF must be using some EclipseLink (used to be TopLink?).

One answer above said to make sure there are no stale files, undeploy app, etc. Would be great if someone that has figured this out could provide more details and explain it. If it is another query that has an error in it, sure would be nice if the error was shown instead of this misleading one.

So far, I've stopped GF, dropped all the tables, restarted, redeployed (in autodeploy folder), and still get this issue right away. I generally build/deploy to autodeploy folder several times in short periods of time, as I make quick changes then build/redeploy.


I encountered this problem also, I found out the exception isn't related with the error file at all, the problem is from another query for example: @NamedQuery(name = "ChannelType.ALL", query = "SELECT channelType FROM ChannelType channelType WHERE channelType.applicationClient.applicationClientId =:applicationClientId ORDER BY channelType.channelTypId ASC")

the problem is from "ORDER BY channelType.channelTypId" its not except to order by primary key ,when I remove this line the exception just gone also.

Maybe someone else could explain why this happen. Thanks


Just for the people out there that are still struggling with this error:

Undeploy your application and check if there are any stale (maybe locked) files left. This would cause the old namedqueries to still exist and thus not replacing them.

Delete the files and redeploy. The error should disappear.

Edit: Also check if you haven't done anything like ... WHERE o.object_id = :id ... instead of ... WHERE o.object = :object ...

This was the solution for my problems. Took me 3 weeks to figure that out. EclipseLink isn't very clear when it comes to exceptions. There was actually a query compile error. Instead it throws a duplicate query exception.


It looks like you have the query defined twice. Either on the same entity, or on another entity, or in orm.xml


Not sure of what you're doing exactly since you're not showing any code but this is what EclipseLink documentation says about error ECLIPSELINK-07092:

ECLIPSELINK-07092: Cannot add a query whose types conflict with an existing query. Query To Be Added: [{0}] is named: [{1}] with arguments [{2}].The existing conflicting query: [{3}] is named: [{4}] with arguments: [{5}].
Cause: EclipseLink has detected a conflict between a custom query with the same name and arguments to a session.
Action: Ensure that no query is added to the session more than once or change the query name so that the query can be distinguished from others.

According to the above description and to the trace, it seems that you're adding a query (actually the same) with the same query name more than once to the session. You shouldn't (or use another query name).


also the error can come from a namedquery malformed, i had an where y o.activo -> that show me the specified error.


I had the problem... The real Exception was a @Named Query malformed but the stacktrace just said:

"Exception Description: Cannot add a query whose types conflict with an existing query"

My solution:

In the persistence unit change Table Generation Strategy to "None" and Validation Strategy to "None". When run again I obtained the real Exception (Malformed Query). I resolved the error in the query, returned to the old configuration in the persistence unit and all exceptions disappeared.


I'm going crazy but at least, this not works:

@NamedQuery(name = "xyx", query = "SELECT count(v) FROM Classe v WHERE v.id =:_id);

this works:

@NamedQuery(name = "xyx", query = "SELECT count(v) FROM Classe v WHERE v.id = :_id);

"WHERE v.id =:_id" was the error

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜