Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

@ElementCollection not working with Maps

Hi.

I´m trying to implement the schema evolution with hibernate (http://www.gigaspaces.com/wiki/display/SBP/SchemaEvolution).
I´m annotating the Map as follows:

@ElementCollection(fetch=FetchType.EAGER)
    @CollectionTable(name = "pps.convenioparametroextra", joinColumns = @JoinColumn(name = "convenio_id"))
    @MapKeyColumn(name = "nombre", length = 64, nullable = false)
    @SpaceProperty
    @Override
    public Map<String, ExtraParameter<String>> getExtraParameters() {
        return extraParameters;
}

ExtraParameter is @Embeddable.

If I use pure hibernate everything works as expected, but with GS when the parent class has more than one extra parameter, I only see one extra parameter in the space. Another interesting thing is that if I debug the openspaces classes when it reads from the hibernate session factory the extra parameters are loaded correctly. The problem occurs when GS puts the objects in the spaces.

Thanks

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2010-12-09 18:23:01 -0500

nullcipher2 gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
0

answered 2010-12-09 18:50:54 -0500

shay hassidim gravatar image
edit flag offensive delete link more
0

Can you try the latest hibernate libraries?
It might be related to some bugs hibernate has.
Shay

answered 2010-12-09 18:44:47 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Shay,

I´m using the latest libraries:

hibernate-core 3.6.0 Final
hibernate-annotations 3.5.6 Final

and so on...

Also note that I did the test using hibernate and spring (no GS) and it works.

Thanks.

2010/12/9 OpenSpaces Forums <forums@openspaces.org>:
> Can you try the latest hibernate libraries?
> It might be related to some bugs hibernate has.
> Shay

nullcipher2 gravatar imagenullcipher2 ( 2010-12-09 19:42:42 -0500 )edit
0

Hi I am facing the same issue with @ElementCollection. My problem is I am using @ElementCollection for Map inside @MappedSuperClass. The problem is when I am writing data to the space and retrieving the same object I am getting all the records inside the Map. But when I closed the session and read the re-start the server, the data will read previously added information from db through gs. This time I am getting only one row even though I have more than one rows in db. Below is my class. @MappedSuperClass public abstract SuperClass{ @ElementCollection(fetch = FetchType.EAGER) @MapKeyColumn(name="key1") @OneToMany @Column(name="key2") public Map<string, string=""> getAddresses() { return addresses; } }

Please send me if you sample snippet which is working in this scenario.

answered 2015-07-07 06:36:04 -0500

chandra gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2010-12-09 18:23:01 -0500

Seen: 754 times

Last updated: Jul 07 '15