File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I avoid duplicate inserts in YoutubeFeed table?

 
rsheyeah hussain
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am searching n fetching records from the youtubeapi and populating it in the youtubefeed table. I have a "searchkeywords" table and a" youtubefeed" result table.
In all of the three tables, ID is the primary key, and in youtubefeed table, youtubeid is the unique key.

Many 2 Many relationship
1 keyword can have many results.
1 result can be associated with many keywords
KeywordSearchResult is the link table

When I run a search against the Youtube API,


For the keyword in searchKeywords table
1. kitchen appliances,
I get the result with the following youtubefeedID
1. LMTRE
2. MNTER
3. NOPOK

For the keyword in searchKeywords table
2. kitchen crockery,
I get the reseult with the following youtubefeedID
4. LMTRE
5. MNTER
6. NOPOK
How do I avoid duplicate inserts in YoutubeFeed table?
YoutubefeedID is set to be unique.

Question:
Even if I use saveorUpdate() , insert statements get generated even if the reocord already exists.
Do I check in keywordSearchResult table if the particular keyword and youtubefeedID result already exists and then write the insert logic ???

Searchkeywords.hbm.xml






Youtubefeed.hbm.xml


Question:
Even if I use saveorUpdate() , insert statements get generated even if the reocord already exists.
Do I check in keywordSearchResult table if the particular keyword and youtubefeedID result already exists and then write the insert logic ???
SQL:

testprblm copy.jpg
[Thumbnail for testprblm copy.jpg]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic