  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | | | How are containers handling (or supposed to handle) CMR & capture-schema issue i | How are containers handling (or supposed to handle) CMR & capture-schema issue i 2004-02-06 - By Vineeth Varghese
Back
Hi folks,
I am new to CMR in EJB2.0 and was going through RMH's book Enterprise Javabean.
I am interested in knowing how the container picks up the relationships. I haven't exactly tried an example but am stuck without a complete understanding of this.
In the 1-1 uni-directional relation example of customer and address, the schema goes like this :- Customer has a foreign key pointing to the primary key of address.
So in the example when I create a Customer bean I supply the cusomter name, age etc and then I create the Address bean and associate the bean with this customer bean but I want to know how is this been translated to the underlaying database. How will the container know that the primary key of Address should be inserted as foreign key in customer table. I am guessing that the container will need some hint from the developer/deployer to accomplish this. Nothing of this sort is given in the book
I expect an anwser like "Container will extract the relationship details from the database" :-) so if this is true but we decide to go from a link table which maps customer_id to address_id how will the data be inserted there.
A doubt along similar lines is regarding the one to many uni-directional example of customers and their phone numbers. The phone number table has a foreign key pointing to customer but the bean is developed to reverse this relationship..i.e customer knows all his phone numbers rather than phone knowing his customer. We do not specify anything about the foreign keys. So when I find a customer and try to retrieve his phone numbers how will the container know that it should query the phones table with the customer id as the customer_id does figure in the phone bean persistance field
I hope I am clear enough with my queries...
Note : I am deploy with the SUN J2EE implementation an using their deploy tool
I also have a doubt which is specific to SUN J2EE 1.4 implementation.
I am trying to capture the schema details from pointbase db that come bundled with J2ee 1.4 I am running into :-
D:\>D:\appserver\Sun\bin\capture-schema -dburl jdbc:pointbase:server://localhost :9092/vinman -schemaname apps -username apps -password apps -driver com.pointb ase.jdbc.jdbcUniversalDriver -table CustomerBean -out CustomerBean.dbschema
using dburl: jdbc:pointbase:server://localhost:9092/vinman using username: apps using password: apps using driver: com.pointbase.jdbc.jdbcUniversalDriver using schemaname: apps java.sql.SQLException : No suitable driver at java.sql.DriverManager (DriverManager.java:532) at java.sql.DriverManager (DriverManager.java:171) at com.sun.forte4j.modules.dbmodel.jdbcimpl.ConnectionProvider.<init>(Co nnectionProvider.java:46) at com.sun.jdo.api.persistence.mapping.ejb.CaptureSchema.main(CaptureSch ema.java:120) Exception in thread "main" java.lang.NullPointerException  at com.sun.jdo.api.persistence.mapping.ejb.CaptureSchema.main(CaptureSch ema.java:177)
I have pbembedded.jar from pointbase/lib in the classpath
Can someone please tell what I am doing wrong? Do I have to include anything more to the classpath?
peace, Vineeth
=========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859 (See http://ISO-8859.ora-code.com)-1"> <title></title> </head> <body text="#000000" bgcolor="#ffffff"> <br> <table cellpadding="0" cellspacing="0" border="0"> <tbody> <tr> <td></td> </tr> </tbody> </table> <br> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859 (See http://ISO-8859.ora-code.com)-1"> <title></title> <tt>Hi folks,<br> <br> I am new to CMR in EJB2.0 and was going through RMH's book Enterprise Javabean.<br> <br> I am interested in knowing how the container picks up the relationships. I haven't exactly tried an example but am stuck without a complete understanding of this.<br> <br> In the 1-1 uni-directional relation example of customer and address, the schema goes like this :-<br> Customer has a foreign key pointing to the primary key of address.<br> <br> So in the example when I create a Customer bean I supply the cusomter name, age etc and then I create the Address bean and associate the bean with this customer bean but I want to know how is this been translated to the underlaying database. How will the container know that the primary key of Address should be inserted as foreign key in customer table. I am guessing that the container will need some hint from the developer/deployer to accomplish this. Nothing of this sort is given in the book<br> <br> I expect an anwser like <i>"Container will extract the relationship details from the database"</i> :-) so if this is true but we decide to go from a link table which maps customer_id to address_id how will the data be inserted there.<br> <br> A doubt along similar lines is regarding the one to many uni-directional example of customers and their phone numbers. The phone number table has a foreign key pointing to customer but the bean is developed to reverse this relationship..i.e customer knows all his phone numbers rather than phone knowing his customer. We do not specify anything about the foreign keys. So when I find a customer and try to retrieve his phone numbers how will the container know that it should query the phones table with the customer id as the customer_id does figure in the phone bean persistance field<br> <br> I hope I am clear enough with my queries...<br> <b><br> Note : I am deploy with the SUN J2EE implementation an using their deploy tool<br> <br> </b>I also have a doubt which is specific to SUN J2EE 1.4 implementation.<br> <br> I am trying to capture the schema details from pointbase db that come bundled with J2ee 1.4<br> I am running into :-<br> <br> D:\>D:\appserver\Sun\bin\capture-schema -dburl jdbc:pointbase:server://localhost<br> :9092/vinman -schemaname apps -username apps -password apps -driver com.pointb<br> ase.jdbc.jdbcUniversalDriver -table CustomerBean -out CustomerBean.dbschema<br> <br> using dburl: jdbc:pointbase:server://localhost:9092/vinman<br> using username: apps<br> using password: apps<br> using driver: com.pointbase.jdbc.jdbcUniversalDriver<br> using schemaname: apps<br> java.sql.SQLException : No suitable driver<br> at java.sql.DriverManager (DriverManager.java:532)<br> at java.sql.DriverManager (DriverManager.java:171)<br> at com.sun.forte4j.modules.dbmodel.jdbcimpl.ConnectionProvider.<init>(Co<br> nnectionProvider.java:46)<br> at com.sun.jdo.api.persistence.mapping.ejb.CaptureSchema.main(CaptureSch<br> ema.java:120)<br> Exception in thread "main" java.lang.NullPointerException <br> at com.sun.jdo.api.persistence.mapping.ejb.CaptureSchema.main(CaptureSch<br> ema.java:177)<br> <br> <br> I have pbembedded.jar from pointbase/lib in the classpath<br> <br> Can someone please tell what I am doing wrong? Do I have to include anything more to the classpath?<br> </tt><tt> <br> <br> peace,<br> Vineeth</tt><font size="-1"><br> <br> </font> </body> </html> =========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help". <p>
|
|
 |