|
Colin If you are using stored procedures over JDBC as a form of RPC, then Hibernate won't be of much use. It is first and foremost an SQL based object persistance layer. Ibatis sounds like a better tool for the job. Lazy loading requires the lazily loaded reference to obtain a valid session, i.e., use the original session it was created through, or in the case that it has been detached (i.e., through serialization between two VM's) to be explicitly assigned a new one. If it can't locate a session to use, it cannot materialize itself, and will throw an exception. Regards, Niall Colin Williams <colin.williams@xxxxxxxxxxxx> Sent by: java400-l-bounces@xxxxxxxxxxxx 04/01/2005 12:41 Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To "'Java Programming on and around the iSeries / AS400'" <java400-l@xxxxxxxxxxxx> cc Subject RE: DAO design pattern Niall, We are not using stored procedures as DAO layer, but calling stored procedures to access our existing business logic on the 400. Hibernate 2 gives you no way to do this. Hibernate 3 allegedly does but I tried it and it does not work. Tried custom persisters, but decided that it would be too complex, and take too long. How did you get your lazy loading to work. Looking at it seemed to indicate you would have to keep sessions open, or reattach to new sessions, as when I tried it the application would crash if the original session was not available? Trust me, Ive crawled the forums extensively, and a lot of the problems I solved were as a result of searching the forums. Don't want this to saound like im knocking hibernate, it's a great framework. I just don't think its finished. I found I had to put in a great deal of work in to get it to do what I wanted. Comparing my experience of Hibernate to Ibatis, Ibatis is not as powerful, but it works straight out of the box. I have had very few problems getting Ibatis to do what I want, and where I got stuck, it seemed to be easy to find workarounds. cheers Colin.W http://as400blog.blogspot.com Extension 5800 Direct dial 0870 429 5800 -----Original Message----- From: Niall.Smart@xxxxxxxxxxxxxxx [mailto:Niall.Smart@xxxxxxxxxxxxxxx] Sent: 04 January 2005 12:16 To: Java Programming on and around the iSeries / AS400 Cc: 'Java Programming on and around the iSeries / AS400'; java400-l-bounces@xxxxxxxxxxxx Subject: RE: DAO design pattern Colin Fortunately I have not needed to work with stored procedures much. If you are using stored procedures as a kind of DAO layer then Hibernate probably won't be of much use, it doesn't really fit that model. It would be worth looking into extending it by through custom persisters for your classes which call the stored procedures. We use a few PL/SQL functions which perform some data-intensive calculations. Using these isn't a problem, you can either hide them behind a view and map the calculated column as read only, or else use a property with a formula expression instead of a column reference. I've also heard Hibernate 3 will have include more support for stored procedures. Lazy loading is working ok for us here, but we are still figuring out the various cache strategies and levels. As Hibernate is quite complex, I've found that at first it doesn't do what you expect, but then after a bit of experimentation you understand the subtleties and then find it works as described. As regards the forum -- it is hit and miss, there is a lot of good material in the archives through its worth searching there first (use AND instead of OR, otherwise the search results are close to useless). The book by the authors of Hibernate called "Hibernate in Action" is out now -- worth checking out. I have found that they are ruthless in to closing bugs as WONTFIX or WORKSFORME! Niall Colin Williams <colin.williams@xxxxxxxxxxxx> Sent by: java400-l-bounces@xxxxxxxxxxxx 04/01/2005 12:00 Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To "'Java Programming on and around the iSeries / AS400'" <java400-l@xxxxxxxxxxxx> cc Subject RE: DAO design pattern Niall, How much joy have you had with hibernate. I have had a lot of problems getting it to do some stuff, especially stored procedures. For stored procedures I had to drop back to native SQL. I soon as I had to do that I lost the benefits of using hibernate in the first place. Apparently you can access stored procedures in the latest version, tried it, didn't work. The other thing that I found was that hibernates lazy loading is either a) very complex to setup, or b) just plain does not work, and I spent considerable time trying to get it to work. With these and other problems I gave up and switched to Ibatis. It was sooooo much easier, as you have control of the sql. The thing that put the nail in the hibernate coffin for me, is that when I had problems I posted questions on the hibernate forum. My questions were ignored? cheers Colin.W http://as400blog.blogspot.com Extension 5800 Direct dial 0870 429 5800 -----Original Message----- From: Niall.Smart@xxxxxxxxxxxxxxx [mailto:Niall.Smart@xxxxxxxxxxxxxxx] Sent: 04 January 2005 11:23 To: Java Programming on and around the iSeries / AS400 Cc: 'Java Programming on and around the iSeries / AS400'; java400-l-bounces@xxxxxxxxxxxx Subject: RE: DAO design pattern We use Hibernate here, it is extremely useful indeed. Anyone want to elaborate on the pros and cons of JDBC versus AS400File? Colin Williams <colin.williams@xxxxxxxxxxxx> Sent by: java400-l-bounces@xxxxxxxxxxxx 04/01/2005 11:23 Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To "'Java Programming on and around the iSeries / AS400'" <java400-l@xxxxxxxxxxxx> cc Subject RE: DAO design pattern Lim, Niall, And if you want to take this stuff even further, Use a framework such as Ibatis or Hibernate for your Object/Database mapping. Hard work initially, especially hibernate, but as your application gets complex, you do see the benefits cheers Colin.W http://as400blog.blogspot.com Extension 5800 Direct dial 0870 429 5800 -----Original Message----- From: Niall.Smart@xxxxxxxxxxxxxxx [mailto:Niall.Smart@xxxxxxxxxxxxxxx] Sent: 04 January 2005 10:59 To: Java Programming on and around the iSeries / AS400 Cc: java400-l-bounces+niall.smart=friendsfirst.ie@xxxxxxxxxxxx; Java Programming on and around the iSeries / AS400 Subject: Re: DAO design pattern Lim Create an interface which defines the data related operations independantly of any particular representation/access method (i.e., file/JDBC, etc) public interface SomeObjectDAO { public void create(SomeObject object) throws DAOException; public void delete(Integer objectID) throws DAOException; public SomeObject findByID(Integer objectID) throws DAOException; public List findByKeyword(String keyword) throws DAOException; } Then write an implementation of this interface using the JT/400 API: public class JT400SomeObjectDAO { public SomeObject findByID(Integer objectID) { AS400File file = .... SomeObject someObject = new someObject(); someObject.setFoo(file.readInteger()); return someObject; } // ... } And finally write a factory to create instances of SomeObjectDAO: public class SomeObjectDAOFactory { private static instance = new SomeObjectDAOFactory(); public static SomeObjectDAOFactory getInstance() { return instance; } public SomeObjectDAO newInstance() { return new JT400SomeObjectDAO(); } } You don't gave to use checked exceptions. A framework like spring can obviate the need for trivial factory objects. "Lim Hock-Chai" <Lim.Hock-Chai@xxxxxxxxxxxxxxx> Sent by: java400-l-bounces+niall.smart=friendsfirst.ie@xxxxxxxxxxxx 03/01/2005 18:40 Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To "Java Programming on and around the iSeries / AS400" <java400-l@xxxxxxxxxxxx> cc Subject DAO design pattern Anybody has a good example on how should I design my web application for any file access related transaction? I'm using struts to create this web apps. I just wonder when I'm in the Action Form and I need to do some edit/insert/update on a record in a file, what is the correct way to design this. I've read some article about DAO design pattern. If this is a good approach, can anybody provide some example. (Note: I'm using Tomcat4.1 and plan to use DBCP for connection pooling.) thanks. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. The information contained in this e-mail is confidential and may be privileged. It is intended only for the addressee(s) stated above. If you are not an addressee, any use, dissemination, distribution, publication, or copying of the information contained in this e-mail is strictly prohibited. Friends First Life Assurance Company Ltd is regulated by the Irish Financial Services Regulatory Authority. If you have received this e-mail in error, please immediately notify us by telephone at 353-1-6610600 or e-mail Helpdesk@xxxxxxxxxxxxxxx and delete the e-mail from your system. Thank you for your co-operation. Friends First Group, Cherrywood Business Park , Loughlinstown Dublin 18. This e-mail has been sent by a company of Bertram Group Ltd, whose registered office is 1 Broadland Business Park, Norwich, NR7 0WF. This message, and any attachments, are intended solely for the addressee and may contain privileged or confidential information. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. If you believe that you have received this email in error, please contact the sender immediately. Opinions, conclusions and statements of intent in this e-mail are those of the sender and will not bind a Bertram Group Ltd company unless confirmed in writing by a director independently of this message. Although we have taken steps to ensure that this email and any attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. The information contained in this e-mail is confidential and may be privileged. It is intended only for the addressee(s) stated above. If you are not an addressee, any use, dissemination, distribution, publication, or copying of the information contained in this e-mail is strictly prohibited. Friends First Life Assurance Company Ltd is regulated by the Irish Financial Services Regulatory Authority. If you have received this e-mail in error, please immediately notify us by telephone at 353-1-6610600 or e-mail Helpdesk@xxxxxxxxxxxxxxx and delete the e-mail from your system. Thank you for your co-operation. Friends First Group, Cherrywood Business Park , Loughlinstown Dublin 18. This e-mail has been sent by a company of Bertram Group Ltd, whose registered office is 1 Broadland Business Park, Norwich, NR7 0WF. This message, and any attachments, are intended solely for the addressee and may contain privileged or confidential information. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. If you believe that you have received this email in error, please contact the sender immediately. Opinions, conclusions and statements of intent in this e-mail are those of the sender and will not bind a Bertram Group Ltd company unless confirmed in writing by a director independently of this message. Although we have taken steps to ensure that this email and any attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. The information contained in this e-mail is confidential and may be privileged. It is intended only for the addressee(s) stated above. If you are not an addressee, any use, dissemination, distribution, publication, or copying of the information contained in this e-mail is strictly prohibited. Friends First Life Assurance Company Ltd is regulated by the Irish Financial Services Regulatory Authority. If you have received this e-mail in error, please immediately notify us by telephone at 353-1-6610600 or e-mail Helpdesk@xxxxxxxxxxxxxxx and delete the e-mail from your system. Thank you for your co-operation. Friends First Group, Cherrywood Business Park , Loughlinstown Dublin 18. This e-mail has been sent by a company of Bertram Group Ltd, whose registered office is 1 Broadland Business Park, Norwich, NR7 0WF. This message, and any attachments, are intended solely for the addressee and may contain privileged or confidential information. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. If you believe that you have received this email in error, please contact the sender immediately. Opinions, conclusions and statements of intent in this e-mail are those of the sender and will not bind a Bertram Group Ltd company unless confirmed in writing by a director independently of this message. Although we have taken steps to ensure that this email and any attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. The information contained in this e-mail is confidential and may be privileged. It is intended only for the addressee(s) stated above. If you are not an addressee, any use, dissemination, distribution, publication, or copying of the information contained in this e-mail is strictly prohibited. Friends First Life Assurance Company Ltd is regulated by the Irish Financial Services Regulatory Authority. If you have received this e-mail in error, please immediately notify us by telephone at 353-1-6610600 or e-mail Helpdesk@xxxxxxxxxxxxxxx and delete the e-mail from your system. Thank you for your co-operation. Friends First Group, Cherrywood Business Park , Loughlinstown Dublin 18.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.