Hello Tim,
just in case you missed it:
I have properly implemented skipRows and limitRows for Oracle last week.
I think the MySQL implementation does also fully support this.
For other databases I am not sure what the status is.
For the other things:
It's hard to explain it all.
I can only advise you to study one of the Web examples like the JSF exmaple.
The class EmployeeRecord is an example for a Business Object (don't be
distracted by the word "Record") in the namespace
org.apache.empire.jsf2.websample.db.records.
In the implmentation you will find the logic for dealing with the retired-flag:
When a person is retired all fields except the retired flag itself are disabled.
Additionally getFieldOptions() returns all valid values for the Department.
This logic is completely independent from the view and can be utilized by any
client using this object.
As far as connection handling is concerned it get's a bit more complicated and
unfortunately it's not all in the examples.
For a JSF Application you'll only need, to implment getAppDataSource in your
Application class that is derived from FacesApplicaiton like this:
@Override
protected DataSource getAppDataSource(DBDatabase db)
{
if (db instanceof FinDB)
return dataSource;
// InvalidArgumentException
throw new InvalidArgumentException("db", db);
}
I hope that helps.
Regards
Rainer
> from: Tim Colson [mailto:[email protected]]
> to: [email protected]
> Cc: [email protected]
> re: Re: Advice for multi-DAO, nested objects, connection mgt, Spring
> config, for Click webapp
>
> Hi Rainer --
> Thanks for the advice/comments, and apologies for my delay'd reply.
>
> > Instead of a PersistenceManger / entity bean combination in Empire-db I
> use classes derived from DBRecord.
> > They essentially represent your business objects and should hold all the
> business logic (for a single record).
>
> Ties the business objects to the persistence layer fairly tightly, yes?
> Let's assume I get over my initial fear of doing that, can you help me
> understand the benefits?
> Does this pattern eliminate having a business model object + DAO
> combination?
>
> > connection management is concerned I always use a request based
> > approach i.e. a connection is taken from a connection pool the first
> > time it is required for a request, then stored on request scope and
> > automatically released at the end of the request
>
> That sounds like an interesting approach, so the web request gets the
> connection? When/where do you open the DB?
> I'll be honest, I've never fully understood ThreadLocal -- in this case, why
> is it
> a good way to hold onto the connection?
>
> > Concerning "paged" retrieval there are two methods on DBCommand
> "skipRows" and "limitRows".
> > Unfortunately those methods are not yet implemented for all database
> drivers and in some cases you will get a NotSupportedException.
>
> Thanks for the pointer -- I had a look, and the EmpireDB side seems sensible
> enough. Then I started down the road researching how to do this correctly in
> Oracle. Seems to me Oracle makes easy things hard, and hard things
> impossible. I'll be looking at it closer in the next week or so and keep the
> list
> in the loop.
>
> > I am not sure whether my comments where any useful at all, but I tried.
>
> Thanks - I do appreciate the replies, and if you have any example code you
> could share, I'd appreciate having a look.
>
> Not everything in life is spelled out. I read a quote yesterday from Thomas
> Edison that I think applies:
> "Opportunity is missed by most people because it is dressed in overalls and
> looks like work."
> http://www.thomasedison.org/index.php/education/edison-quotes/
>
> I need to get to work. :-)
> -Tim