-
1. Re: Collection problem
mirtzi Nov 13, 2008 9:59 AM (in response to mirtzi)I forgot to say... it works if I make the collection unversioned... so I think it's an envers problem
-
2. Re: Collection problem
adamw Nov 13, 2008 11:16 AM (in response to mirtzi)Hello,
how can you have a bi-directional relation with @IndexColumn? If two Equipments are referencing the same Component, on different indexes, you clearly need a join table, so the "mappedBy" won't work here (even without versioning - try it and check that the field in the database is always null)
--
Adam -
3. NotSerializableException
mirtzi Nov 24, 2008 8:14 AM (in response to mirtzi)Hi,
I fixed my bi-directional relation. This is how it looks like:@Entity @Table(name = "EQUIPMENT") @Versioned public class Equipment extends BaseEntity{ private List<Component> components; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @org.hibernate.annotations.IndexColumn(name = "idx") @JoinColumn(name = "equipment_id") public List<Component> getComponents() { return components; } //setter }
@Entity @Table(name = "COMPONENT") @Versioned public class Component extends BaseEntity{ private Equipment equipment; @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "equipment_id", insertable = false, updatable = false) public Equipment getEquipment() { return equipment; } //setter }
All works well in my tests but in my application (a Spring WebFlow app) I get java.io.NotSerializableException: org.jboss.envers.entities.mapper.relation.lazy.proxy.ListProxy
Has anybody encountered serialization problems before with Envers?
-
4. Re: NotSerializableException
mirtzi Nov 24, 2008 9:25 AM (in response to mirtzi)Shouldn't this class implement Serializable?
Offtopic: How can I edit a post? -
5. Re: Collection problem
adamw Nov 24, 2008 12:28 PM (in response to mirtzi)Hello,
maybe it should :) - please create a JIRA issue, with a test case, if you could.
I've got two remarks though:
- versioning a list of components won't yet work (it's not yet supported)
- the list proxy is there for lazy initializaition, so I guess you can get exceptions when trying to access the elements on the list after transporting the class somewhere. Why are you serializing the classes?
--
Adam -
6. Re: Collection problem
mirtzi Nov 25, 2008 4:18 AM (in response to mirtzi)Hi,
I created a JIRA issue, http://opensource.atlassian.com/projects/hibernate/browse/HHH-3623 , I hope it's filled correctly... it's my first one :)
I wrote there why my classes need serialization and what was the (temporary) fix.
I didn't find the project's road map... when will it be a new release?
I know about the collection of components, mine are entities (the id is in the superclass from the first post... I forgot to copy it).
P.S: Thanks for the quick responses. -
7. Re: Collection problem
adamw Nov 25, 2008 10:27 AM (in response to mirtzi)Hello,
ok, resolved :)
A new release will be in about 1-2 months.
--
Adam