Contrary to what you might read online, it is impossible to fully
abstract away your persistent framework. Take Hibernate for example, if
you are inserting large objects you will have manually flush/clear your
session every X inserts to avoid running into OutOfMemoryErrors. Other
frameworks handle this differently (in db4o for example, they use weak
references so you never run out of memory). Every framework seems to
have its own little "quirk" and you end up with leaky abstractions.
In my use-case, it makes a lot of sense to bundle DB-aware methods with
the POJO. For example, normally your POJO would be:
class Theme
{
public String getName();
public void String setName();
}
but I go further:
class Theme
{
public String getName();
public void String setName();
public Theme getCanonicalInstance();
}
where getCanonicalInstance() is DB-aware. There are a lot of helper
functions that manipulate or operate on themes and I bundle them with
class Theme. This simplifies my code a great deal in exchange for the
lack of separation between the persistence and data layer (which is fine
with me). Your use-case might differ <shrug>
Gili
Igor Vaynberg wrote:
The pojos are great, it's the save and load methods that I was referring to.
-Igor
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Timo Stamm
Sent: Friday, October 07, 2005 4:43 PM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Standard for database integration?
(Please!)
Igor Vaynberg wrote:
Having code like this
Class Person {
private long id;
private String username;
private String firstname;
private String lastname;
...getters/setters...
public void save() {...}
public void loadById(long id) {...}
}
Can be done with anything from hibernate to db40 to jdbc -
its still a
poor way to write an application.
I don't like having to create a class for each data entity.
On the other hand, those bean-style POJOs are very common and
supported by various frameworks.
Can you give reasons for your opinion?
Timo
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads,
discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
http://www.desktopbeautifier.com/
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user