• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

@ManyToMany delete problem

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys.

I'm dealing with a jpa based app and my basic knowledge doesn't allow me to successfully delete an entity.

I try the following code:

But when I create the query, an exception is thrown:


10:50:44,321 INFO [STDOUT] 2008/09/12 10:50:44 ERROR hibernate.hql.PARSER[http-127.0.0.1-8080-1]: line 1:58: unexpected token: join
java.lang.IllegalArgumentException: node to traverse cannot be null!
at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:31)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:254)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:92)
at es.encore.nollego.comun.dao.subcategoria.SubcategoriaDAO_HBM.deleteByNick(SubcategoriaDAO_HBM.java:206)
... 34 more



It seems the problem is the join clause, but I've tried in several ways but didn't succeed. Can anybody help me with this issue?

Here you have the entities:



Previously I've successfully done a select:



Thanks in advance...
 
Roberto Lopez Lopez
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've changed my code but still no results.



The executeUpdate() method throws the following:

org.hibernate.QueryException: Expected positional parameter count: 2, actual parameters: [
bdd.subcategoria.compras.alimentacion,
es.encore.nollego.comun.to.UsuarioTO[...]
]
[delete from SubcategoriaTO sc where sc.subcategoria=? and sc.usuarios=?]



Where's the problem?
 
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if this helps......

More from the dumbass mistake department. Trying to boot up a Hibernate based project, I was getting this error:

java.lang.IllegalArgumentException: node to traverse cannot be null!

This was occurring during parsing of the named query information in the configuration. Eventually I tracked it down to this query:

@NamedQuery(
name=Comment.COUNT_COMMENTS_BY_ARTICLE,
query="count(*) from Comment where article = :article")

The problem was simply that I'd omitted a vital keyword from the query - because I'm normally retrieving lists of simple entities with queries of the form "from Foo where bar = :spong", which is quite legal, I failed to spot the missing select for ages even where it was staring me in the face! Here's that corrected query:

@NamedQuery(
name=Comment.COUNT_COMMENTS_BY_ARTICLE,
query="select count(*) from Comment where article = :article")

it was taken from....
Node to traverse cannot be null
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic