-->
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: hibernating a HashMap through annotations?
PostPosted: Fri Nov 11, 2005 4:28 pm 
Newbie

Joined: Tue Aug 09, 2005 3:26 pm
Posts: 2
Location: New Hampshire
Hibernate version: 3.0

Name and version of the database you are using: MySql


I'm looking for an example of how to set up my annotations to hibernate a simple java hashmap to a MySql database.

Given an extremely simple class as defined below, what should the annotations be to cause this to hibernate the HashMap propHash correctly.

Any help would be very, very appreciated.... Thanks!

Mike

{
Code:
import ...;

/**
*
* @hibernate.class
* table="MYCLASS"
*
*/
public class MyClass extends MyBaseClass implements Serializable
{

    private Long myClassId;
    private String myClassNickName;

    private HashMap<Integer, String> propHash  = new HashMap<Integer,String>();

    public void setMyClassId(Long id)
   {
        myClassId = id;
    }

    /**
     *
     * @hibernate.property
     *
     **/
     public Long getMyClassId()  {  return myClassId; }

     public void setMyClassNickName(String sName)
     {
         myClassNickName = sName;
      }

     /**
      *
      * @hibernate.property
      *
      **/
     public String getMyClassNickName() {  return myClassNickName  };

     public void setPropHash(HashMap map)
     {
          propHash = map;
     }

     /**
      *
      * // what here?
      *
      **/
      public HashMap getPropHash()
      {
          return propHash;
      }

      public myClass() {  super() };

}
     


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.