From: <leg...@at...> - 2003-07-28 15:17:14
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HBI-7 Here is an overview of the issue: --------------------------------------------------------------------- Key: HBI-7 Summary: Allow mapping class to more than one table/view Type: Improvement Status: Unassigned Priority: Major Project: Hibernate 1.2 Assignee: Reporter: Frank Calfo Created: Mon, 28 Jul 2003 10:16 AM Updated: Mon, 28 Jul 2003 10:16 AM Description: I have multiple views that return different results, but all share a common structure I have a class defined to represent one row from the view I can map this class to the view and use a hibernate query to get a collection of objects Now I want to be able to define the second query that returns data from the second view. It seems like I would need to be able to map the same class to a different view but I don't think that will be allowed in Hibernate. For example: Here's the common class mapped to the first view: <class name="ResultSetRow" table="VW_REQUESTS_MANAGER" mutable="false"> <id name="reqId" column="req_id" type="long" unsaved-value="null"> <generator class="assigned"/> </id> <property name="name" column="name" type="string"/> <property name="date" column="date" type="timestamp"/> <property name="type" column="type" type="string"/> </class> and here's the Hibernate query that returns a collection of objects for each row returned by the view: <query name="PendingRequests.ForManager"> from ResultSetRow as list where list.managerId = :manager_id </query> The key issues are these: 1) The structure of each result set will always be the same, only the contents will differ 2) A set of different database views will be created that share the same structure but return different content according to their purpose 3) I'd like to be able to share a common class instead of defining a different class for each different result set 4) I'd like to be able to create a set of mappings for each database view that returns the common class that defines the structure of the result set Can I use a common class and map it to different table/views - or does the rule that one class maps to only one table prevent it ? Thanks! --------------------------------------------------------------------- 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 |