|
Carel, Don't get Java Beans and Enterprise Java Beans (EJB) confused. They are very very different animals. I also dislike EJB and probably for the same reasons you do. I'm more interested in stuff like JDO, Hibernate or iBATIS for my database access. Java Beans is just a standard way of writing getters and setters so that an IDE can display properties instead of fields. If you have a GetName and a SetName in a Java Bean then an IDE can display a Name property for the object that you can display and change. If you provide only a GetName then you have a Name property that you can display but can't change. You can then save those values in a properties file that can be used to initialize the Java Bean. EJB deals with stuff like container managed persistence (that database access stuff), distributed applications and other important stuff I'm not aware of and am not sure I want to know. What's so hard to write a program that, given a file, will generate RPG for those 50 getters and setters? It's not that hard and it's a rather interesting program. Once you write that then you'll never have to code a database file statement in your applications programs. For every new file you create you run it through your code generator. Flesh out the generated source with the important stuff. Yeah, using getters and setters avoid programming errors too. That's the idea. Can't do a typo in a field name and update the wrong field. Paul -- Paul Morgan Senior Programmer Analyst - Retail J. Jill Group 100 Birch Pond Drive, PO Box 2009 Tilton, NH 03276-2009 Phone: (603) 266-2117 Fax: (603) 266-2333 "Carel Teijgeler" wrote > JavaBeans? I thought so. Suitable for RPG? Don't think so. > > My personal dislike of EJB is database access, which is the main issue on an AS/400. > > If a file has 50 or more fields i have to write 50 or more get-methods to retrieve one single piece of data, whether or nor it is derived data (calculations) and 50 or more setters to update a single piece of data, before the record will be updated. I am too lazy to write such nonsense. > I know in the *SRVPGM the fields of a PF are global, so any procedure (read, set, get) has access to all data of a read record with only checking the key value(s). But what do you achieve with that? Not much, I think. The given example looks ridiculous. > > I prefer one read of the record and all data available. Data can be passed in a DS (or with a pointer). If you like you can format the required values in the *SRVPGM and pass it back in the DS. > > The last point on erroneous changing data in the wrong field. PF fields not reverenced ina PGM are not accessable (at least that is my experience when in DBG, I expect that to be normal behaviour), so putting wrong data in fields is a progamming error, not a logical one. > > Each his/her own preferences, but EJBs (and their clones) are (imho) not suitable for database access and maintenance. > > Just my 2 Euro cents. > > Regards, > Carel Teijgeler
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.