-->
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.  [ 2 posts ] 
Author Message
 Post subject: Is Update / Insert supported for nested <element ...>
PostPosted: Tue Sep 02, 2008 10:55 am 
Newbie

Joined: Tue Sep 02, 2008 9:48 am
Posts: 2
I'm having to map hibernate in some unorthodox ways to an existing database schema that cannot be modified, and have run into a problem with hibernate not issuing any update or insert statements for a relationship.

I have two tables:
Code:
webConsumer {
    ConsumerID INT IDENTITY(1,1) NOT NULL,
    ...
}
with consumer_id as its primary key.

Then another table that holds various other information for WebConsumers:
Code:
webAttribute {
    ConsumerID INT NOT NULL,
    AttributeValueTag VARCHAR(50) NOT NULL,
    AttrValue VARCHAR(100) NULL
}

webAttribute has a unique constraint on consumer_id, AttributeValueTag with a foreign key constraint on consumer_id.

I have some properties stored in webAttribute that are many-to-one with webConsumer but I just want a list of strings from the AttributeValueTag column from the webAttribute table, and I don't want to have to code a set of webAttribute objects with composite keys to update this list of strings.
The relevant part of my WebConsumer xml is this:
Code:
        <bag name="propertyTypes" inverse="true" table="vw_Types_Properties"
        cascade="all, delete-orphan" lazy="false">
            <key>
                <column name="ConsumerID" not-null="true" />
            </key>
            <element type="java.lang.String" column="AttributeValueTag" unique="true" />
        </bag>

Where the table "vw_Types_Properties" is just a view of webAttributes where AttributeValueTag LIKE 'Property%'.

This mapping issues the correct select statement and gets the data great as a List property (returns a list of strings that came from the AttributeValueTag field). The java object even adds and removes items from the list in memory but when I use a corresponding dao to save the data hibernate does not issue any INSERT or UPDATE sql at all.

I'm using <join><property .../> tags elsewhere with <sql-insert>...</sql-insert> for some one-to-one properties in the same table, which work great but now I need to do the same sort of thing as a one-to-many, and I'm stumped.
Any help would be greatly appreciated!


Top
 Profile  
 
 Post subject: Nobody wants to touch this one?
PostPosted: Fri Sep 05, 2008 4:53 pm 
Newbie

Joined: Tue Sep 02, 2008 9:48 am
Posts: 2
???


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.