-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Interface-Implementation collection doubt
PostPosted: Wed Jun 06, 2007 9:22 am 
Newbie

Joined: Wed Jun 06, 2007 9:14 am
Posts: 14
Hello!
I've read in the Java Persistence with Hibernate book that Hibernate expects a HashSet implementation for a Set interface, and a TreeSet implementation for a SortedSet interface. I created a type named AulaReserva and defined a natural order for it and mapped it this way in an entity class:

Code:
private Set<AulaReserva> fAulasReserva = new TreeSet<AulaReserva>();

@OneToMany(mappedBy = "dataReserva",
cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
public Set<AulaReserva> getAulasReserva()
{
    return fAulasReserva;
}

public void setAulasReserva(Set<AulaReserva> aulasReserva)
{
    fAulasReserva = aulasReserva;
}


Notice that I'm using Set and not SortedSet for the property. So, my question is this: will Hibernate replace my TreeSet implementation by a HashSet implementation? If so, this would be disastrous for me, as I need the collection to be sorted using its natural order. Do I really have to use the SortedSet in this case?

Thank you.

Marcos


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.