users@glassfish.java.net

Restricting access to particular table

From: <glassfish_at_javadesktop.org>
Date: Mon, 23 Apr 2007 04:01:08 PDT

Hi,

Am using Hibernate with Java Persistence API.

The question, in short is:
How do I restrict the Java Persistence API to access rows only from one table & not from any other table i.e. Even though it might require access to other tables, it should access rows only from one particular table. How to enforce this?

In detail, this' the problem:

We have a data model like this:

Level 1 class
......within this there is Level 2 class
............within Level 2, there is Level 3 class

it's just like XML data where we have a tag within another tag & so on. The root tag is Level1 & the tags in the next level are Level2, let's assume...and so on.

i.e. an instance of Level1 class can contain many objects of Level2 within it. And an instance of Level2 class can contain many objects of Level3 within it. Within the Level1 class, we have methods to fetch corresponding objects from Level2. & the same for Level2 class. So, using Java Persistence API, when accessing instances of Level1, they automatically fetch corresponding instances of Level2 & Level3. Level1 has a corresponding table in the database called Level1. & the same with Level2 & Level3. How do I restrict the Java Persistence API to fetch objects only from Level1 table & not from other tables?

Thanks.
[Message sent by forum member 'raaga' (raaga)]

http://forums.java.net/jive/thread.jspa?messageID=213695