Hibernate: storing a java.util.Map with some extra information

From: Peter Griffin (newsgroups_at_petoria.de)
Date: 12/22/04

  • Next message: IINET: "Hibernate not finding Oracle driver - despite straight JDBC working"
    Date: 22 Dec 2004 06:04:18 -0800
    
    

    Hi,

    I have a table used by a legacy application:

    CREATE TABLE GATHERED_VALUES (
            CUSTOMERID VARCHAR(20) NOT NULL,
            GROUP VARCHAR(40) NOT NULL,
            KEY VARCHAR(40) NOT NULL,
            VALUE VARCHAR(40),

            PRIMARY KEY (CUSTOMERID, GROUP, KEY)
    );

    I need to access it from a Java app, if possible via hibernate.

    The corresponding hibernate class should be looking something like
    this:

    public class GatheredValues {
            private String customerId;
            private String group;
            private Map values; // GATHERED_VALUES.KEY, GATHERED_VALUES.VALUE
            
            :
            :
    }

    For creating an instance of GatheredValues I'd like to just hand over
    the customer id and the group.

    All documentation I read mentioned:
    - an ID-column is needed for a Map
    - the Map must be stored in a seperate table

    Is this true? Does anyone know if my problem can be solved via
    hibernate?

    Peter


  • Next message: IINET: "Hibernate not finding Oracle driver - despite straight JDBC working"

    Relevant Pages

    • Re: Nochmal Maps bei Hibernate
      ... schau mal in der Hibernate 3.1.2 Doku, ... ich habe eine persistente Klasse ... private Map getMyMap(){return myMap;} ...
      (de.comp.lang.java)
    • Re: Hibernate: how to retreive only few properties in a class
      ... Note the "getEmployeesSummaryList" and the return employee clause. ... I get a java.sql.SQLException: Column 'LoginName' not ... My guess is that Hibernate tries to map every column ... Hibernate to map only the columns found in the ResultSet? ...
      (comp.lang.java.databases)
    • Re: DAO patterns in the "Real World"
      ... > moving around huge objects of which the majority of the attributes I'm ... that's one of the things Hibernate can do. ... Basically, it lets you map ... of 1:n and n:m relationships as Java collections. ...
      (comp.lang.java.programmer)
    • OR mapping for java.util.Hashtables?
      ... standard OR mapping library like Hibernate) would map a ... java.util.Collection datastructure to a relational database? ... Precisely I need to map a ...
      (comp.lang.java.programmer)