[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3246) Enhance Criteria#list to allow passing custom List instances
Holger Haag (JIRA)
noreply at atlassian.com
Mon Apr 21 10:51:33 EDT 2008
Enhance Criteria#list to allow passing custom List instances
------------------------------------------------------------
Key: HHH-3246
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3246
Project: Hibernate3
Issue Type: Improvement
Reporter: Holger Haag
Priority: Minor
Hello,
it would be great for us if Criteria#list allowed to pass instances of java.util.List:
Currently there is only
public List list();
This calls Session(Impl)#list, which initializes the list with CollectionHelper.EMPTY_LIST;.
What I'd like additionally is
public void list(final List list);
>From a first look at Criteria/CriteriaImpl, Session/SessionImpl that seems to be feasible, although I must admit that I'm not really familiar with the hibernate source code.
The reason behind this improvement request is that in our company we often have our own list classes extending ArrayList<sometype>. These customized list classes provide methods that would otherwise have to go into static utility classes, e.g. if there is a Price class, the PriceList class (extending ArrayList<Price>) provides a total() method.
So what we do to get a PriceList is
(1) list = crit.list()
(2) priceList = new PriceList()
(3) priceList.addAll(list)
which temporarily creates two lists, with one list being immediately discarded by garbage collection.
Any comments on that ?
Thanks in advance
Holger
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list