-->
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: Table names stored in additional index table
PostPosted: Thu Nov 22, 2007 5:53 am 
Newbie

Joined: Wed Nov 21, 2007 1:42 pm
Posts: 2
Hey,

I have a "tricky/legacy" problem that I want to sort out with hibernate ...

Each time I need to do something with with a text, I need to:

1) obtain table name from "book_index" table by "using book_ref" column

2) search for the entity in obtained table

Note that,

I know that I can solve this with direct queries,

I can not change the DB structure (it a legacy optimization try that's heavily used by other systems),

There are hundreds of "book_tablename_XXXX" like tables with same structure,

and finally I need to do search/CRUD operations across all the "book_tablename_XXXX" like tables.

Thanks for any ideas,
Dusan


Db structure:

CREATE TABLE `book_index` (
`book_ref` int(11) NOT NULL auto_increment,
`tablename` varchar(255) default NULL,
`date` date default NULL,
`active` int(11) default NULL,
PRIMARY KEY (`ref`),
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `book_tablename_XXXX` (
`text_ref` int(11) NOT NULL auto_increment,
`book_ref` int(11) NOT NULL,
`element_id` int(11) default NULL,
`record_id` int(11) default NULL,
`chapter_id` int(11) default NULL,
`chapter_order` int(11) default NULL,
PRIMARY KEY (`ref`),
KEY `element_id` (`element_id`),
KEY `record_id` (`record_id`),
KEY `chapter_id` (`chapter_id`),
KEY `chapter_order` (`chapter_order`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

book_index.book_ref = book_tablename_XXXX.book_ref


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.