Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling session facade methods from my code

513155Aug 23 2006 — edited Aug 23 2006
My application consists of two projects: Interface and Model. Model, of course, is used for access to a database using TopLink with POJOs and session facade bean...Pretty much like thing done int tutorial. While, naturally, Interface project are the web pages etc. Standard web application.

Now, there is no problem with using data controls from session facade bean (drag and drop to the form for making tables, lists, forms etc.), that works fine.

What I need is to use methods from my session facade bean in my code. For example, I have made a TopLink query findAllLabels. It is exposed in session facade bean UtilBean so in the bean the code is

List<Labels> findAllLabels(){
...
}

So In some part of my code (for instance, in some backing bean) I would like to call this query. I have done this:

UtilBean util=new UtilBean();
List<Labels> labels=util.findAllLabels();

And this works fine, for now. But, I'm wondering, is this the correct solution, and is there some more ellegant and correct way to do this? Is it correct to instantiate a session facade bean in this way?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 20 2006
Added on Aug 23 2006
4 comments
225 views