From: <leg...@at...> - 2003-12-06 14:12:41
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-529 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-529 Summary: mapping a class with several tables? Type: Improvement Status: Unassigned Priority: Major Project: Hibernate2 Components: core Versions: 2.1 final Assignee: Reporter: LiMo Created: Sat, 6 Dec 2003 8:12 AM Updated: Sat, 6 Dec 2003 8:12 AM Environment: rc1, mysql Description: can I make a class associate with several similar table ? It is a big problem for me. my project is a refactoring project to a old system. in the old system, we create a table by each year. such as: TBL_NEWS_2003, TBL_NEWS_2002 so when we need search in years, we use UNION to select from all table. BUT how can i do this in hibernate?? The situation is: When one develop a website such as a news website. It its very easy to decide making a generic News.class to fit for all kinds of news. eg. A news may have title, content, date ... so we develop a News.class. but we have different news, like entertaiment, sport, government, techinical ..... so, we must have dynamically mapping to News.class News.class should associate to several *.hbm.xml file, each file figure to a table. like News.sport.hbm.xml, News.entertaiment.hbm.xml (May be we can specify the different table name just in the filename) and the Configuaration can read all xml and one can query News.class in all different table or only one table. BUT actually I must make a News.hbm.xml for it. and i wrtie table name in the XML. OR when i query some news, can I specify a tablename or modualname parameter to the Session and get the same News.class from different table. can i make myself understand? Anyone who can give me the solution?? Thank you! --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |