Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help Please

 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
can anyone pass me a simple example using relationship(entity beans with relationship).I am not able to find any simple example so that i will be able to understand concept.i tried google search also but i was not successfull.
I tried roster example for sun but it is bit complex to understand.

Thanks
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll send you mine, but I can't use email. I'll try to post the code at the ranch tomorrow, but you'll have to do the container config yourself. I've used J2EE RI.
[ March 22, 2007: Message edited by: Satou kurinosuke ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sending you my java files and the descriptor generated by the Deploytool.
You'll have to generate client stubs, SQL...
I've tested it with J2EE RI and Cloudscape. It's pretty dirty and almost no comment, but I hope it can help.
Movie and Trailer entity beans have a One-To-One relationship.
This code checks :
1. The One-To-One relationship
2. Finder method
3. Select method
4. Home business method

The Movie entity bean

[ March 22, 2007: Message edited by: Satou kurinosuke ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Trailer entity bean
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The MovieMaker session bean (makes a moive, a trailer, and sets each other)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally, the client app

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The deployment descriptor.
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Satou kurinosuke
Now i will try this example.
Please send me .ear file of above example.
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my email id is gowher_naik@rediffmail.com
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gowher,
I wanted to send you the ear, but I can't use email.
I've made this sample at my office, and the security policy is really strict.(no mail, no ftp. I'm lucky enough to be able to use the ranch !)
I hope you can make one yourself. It's not difficult to make one with Deploytool. Sorry for the inconvenience.
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i deployed and run above bean successfully.
I have some doubts which i will ask you.
Thanks
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satou
Tables created by above bean are as follows

SQL> select * from "TrailerBeanTable";

_movie_movieId description trailerId
------------- ----------- --------
RB1 Trailer for RB1 TR1

SQL> select * from "MovieBeanTable";

_trailer_trailerId movieId movieName
------------------ --------- ----------
TR1 RB1 Return of the beans

In "TrailerBeanTable" table what is _movie_movieId?

In "MovieBeanTable" table what is _trailer_trailerId?

if they are Foreign keys then why DB let me insert row(using oracle console directly) for "TrailerBeanTable" which is not present in "MovieBeanTable" table?

Thanks
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the way the tool creates tables. It may not be foreign keys. In the Deploytool, you can check the generated SQLs when using "Auto generate SQL". It might be only standard columns refering to another table's column.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic