• 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

Beginner needs help with sql/ejb-ql

 
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have the following question about sql and ejb-ql:


My boss forces me to use a flat table as above. Here is what happened to this table:

1. A user inserted a record (key and pk == 1)
2. They then updated the same record. You will notice that the "key" is the same (pk == 2)
3. They then updated the update. Key is the same and pk ==3
4. They then inserted a fresh record (pk ==4)
5. Fresh insert again
6. Fresh insert again
7. Delete of immediately previous fresh insert

You will notice that for each action I have an insert into the db (this is for logging/history purposes).

I need to be able to retrieve all record that would have survived the updates and deletes through sql i.e. those marked by a star.


What would be the sql and the ejb-ql for that?

Any clue welcome,

Thanks in advance,

Julien Martin.
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simple SQL will be


This will not perform good if the data set is huge (which I believe will be). Another approach will be


These SQL will work across products however if you are familiar with Analytical functions you can use them as they will return the results much faster with less cost.

It's been while I looked at ejb-ql, I believe others should help you on this.
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Thanks Purushothaman!
2. Any one has got any idea on how to do that with ejbql 2.1???
Julien.
reply
    Bookmark Topic Watch Topic
  • New Topic