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: Can 2 associated classes map to the same table row?
PostPosted: Mon May 26, 2008 5:00 pm 
Newbie

Joined: Thu Jul 27, 2006 10:41 pm
Posts: 6
I have a database table FILES which contains columns; FILE_ID, FILE_NAME, MIME_TYPE and FILE_DATA. The FILE_DATA column is SQL Server Image, Initially I had a single C# class and mapping to represent a File. I found that queries were quite slow because it always read the FILE_DATA image even though I often only needed the header information. I split up the C# class and mapping into two seperate classes and mappings. File maps columns FILE_ID, FILE_NAME and MIME_TYPE and also has a many-to-one association with FileData. FileData contains columns FILE_ID and FILE_DATA. Both mappings map to the same database table FILES. Now queries for File are much faster but I have problems inserting a File. It seems to be trying to insert an seperate row for FileData but I need them to share the same row and insert as one. Is this possible or must I have two seperate rows in two seperate tables?


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.