• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error when merging manyToMany relation in JPA  RSS feed

David Freed
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JPA project which searches tweets by keword and should persist the key - tweet pairs in the database. The project has the following entities :

**Tweet** entity

Now I have a class for persisting a Keyword,

As you can see in the Keyword Entity, it has a joinTable and therefore a field that can have a set of tweets.

So whenever I get a key and a set of tweets, first I make a user entity, a set of hashtags and urls out of that tweet. Then I have a new tweet entity object.
In the next step I add this tweet(these tweets) to the keyword entity object.
Now I persist this keyword.

Problem: When I want to search for a keyword for the next time, the keyword exists and I should merge, but I get the following error :

Thank you so much in advance. I'm waiting here.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!