[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-826?page=co...
]
Max Rydahl Andersen closed HBX-826.
-----------------------------------
Resolution: Fixed
Fix Version/s: 3.2.beta11
Multiple issues here fixed in one:
* basic type is now sorted or not (SortedMap vs. Map)
* do not try and instantiate the comparator (circular dependency on not-yet generated code
in sorter possible now)
* generate default value with comparator so it is also correctly sorted when it is not
persistent (new Set(new Comparator());
* ...and handle that TreeMap/TreeSet does not support (0) as init value.
Example:
import comparator.NoopComparator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
public class Article implements java.io.Serializable {
...
private List<Article> bagarticles = new ArrayList<Article>(0);
private Map<String,Article> AMap = new HashMap<String,Article>(0);
private List<Article> aList = new ArrayList<Article>(0);
private SortedSet<Article> sortedArticlesSet = new TreeSet<Article>(new
NoopComparator());
private SortedMap<String,Article> sortedArticlesMap = new
TreeMap<String,Article>(new NoopComparator());
private SortedMap<String,Article> naturalSortedArticlesMap = new
TreeMap<String,Article>();
...
In svn now - would love to get feedback/verification on it fixing your issue!
Code generator: sortedset are not instantiated by default
----------------------------------------------------------
Key: HBX-826
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-826
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2java
Affects Versions: 3.1beta3
Environment: Hibernate 3.1.3 and plus.
MySQL 5.0
Reporter: Julien Fourment
Priority: Minor
Fix For: 3.2.beta11
Hi,
When defining a regular (not sorted) set in an hbm file, the generated java will define
the field as this:
private Set<Package> packages = new HashSet<Package>(0);
But when defining a sorted set in the my hbm file (using sort attribute with a comparator
class) the generated java looks like this:
private SortedSet<ServiceVersion> versions;
Type is correct, but the field in not populated with a default implementation by default,
like treeset ?
I would expect something like :
private SortedSet<ServiceVersion> versions = new TreeSet<ServiceVersion>(new
myComparator());
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira