• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Adding to join table

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

I have a TAG table and an ARTICLE table. The relationship in the ejb is set to many to many creating a join table automatically.

1) I get a string of tags and delimit them appropriately.
2) I then store each of the 'tokens' in an array.
3) Once getting these tokens, check each token and ensure it doesn't exist in the TAG table
3.1) If it does exist get that TAG object and store in the TAG_ARTICLE table
3.2) if it doesnt store the new tag in the TAG table aswell as the TAG_ARTICLE table.

Our problem is at 3.1; the tag is found but does not get added throwing an exception:
Error: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: entities.Tag

3.2 however is working perfectly.

Thanks in advance,
Tanil
 
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please, provide the code of your entities.
reply
    Bookmark Topic Watch Topic
  • New Topic