-->
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: "map" collections
PostPosted: Sat Dec 04, 2004 8:30 pm 
Newbie

Joined: Thu Nov 04, 2004 12:52 am
Posts: 4
Having trouble mapping a "map" collection:

Table 1:
Code:
CREATE TABLE Messages (
    messageId BIGINT IDENTITY NOT NULL)


Table 2:
Code:
CREATE TABLE MessageProperties (
    messagePropertyId BIGINT IDENTITY NOT NULL,
    messageId BIGINT NOT NULL,
    messagePropertyName VARCHAR(50) NOT NULL,
    messagePropertyValue VARCHAR(4000) NOT NULL)


Mapping:
Code:
<map
    name="messageProperties"
    table="MessageProperties"
    lazy="false"
    sort="unsorted"
    cascade="none"
    outer-join="true"
>

    <key
        column="messageId"
    >
    </key>
    <index
        column="messagePropertyName"
        type="java.lang.String"
    />
    <element
        column="messagePropertyValue"
        type="java.lang.String"
        not-null="false"
        unique="false"
    />
</map>


Message class:
Code:
public class Message {

    private Map messageProperties;

    public void setMessageProperties(Map messageProperties){
        this.messageProperties = messageProperties;
    }

    public Map getMessageProperties(){
        return messageProperties;
    }
}


There is no MessageProperty class, I'm trying to load values from the MessageProperties table directly into a Map object, with the value from the messagePropertyName column becoming the Map entry's key and the value from the messagePropertyValue column becoming the Map entry's value.

So after loading a Message object, that definitely has associated properties in the database, the messageProperties Map is null. I'm not sure what the problem is, but I'm having a hard time finding any help in the forum or the documentation. Any help would be greatly appreciated!

Brian


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.