multiple-resultsets

Preferred way of retrieving row with multiple relating rows

情到浓时终转凉″ 提交于 2019-12-13 06:28:31
问题 I'm currently hand-writing a DAL in C# with SqlDataReader and stored procedures. Performance is important, but it still should be maintainable... Let's say there's a table recipes (recipeID, author, timeNeeded, yummyFactor, ...) and a table ingredients (recipeID, name, amount, yummyContributionFactor, ...) Now I'd like to query like 200 recipes with their ingredients. I see the following possibilities: Query all recipes, then query the ingredients for each recipe. This would of course result

Hibernate JPA, inheritance and Stored Procedure returning multiple result sets

独自空忆成欢 提交于 2019-12-11 02:04:49
问题 I am attempting to consume multiple result sets from a stored procedure using Hibernate 4.3.5.Final (JPA 2.1) -- and I have not been able to get it to work. I am using Sql Server 2008. The stored proc result sets have different columns with some commonality but not enough to combine them into a single result set. The commonality is expressed in Java with an inheritance hierarchy. I've been using the InheritanceType strategy of TABLE_PER_CLASS even though there really aren't explicit tables in

Hibernate: Multiple Result Sets

不问归期 提交于 2019-12-10 10:19:55
问题 from what I've read in the Hibernate documentation/online it sounds like Hibernate does not have the ability to handle multiple result sets. I'm looking to make a MySQL DB call in an application that relies on Hibernate, that will return multiple result sets. What solutions have you used that "play well" with Hibernate, keeping in mind it's likely this will be the only call where multiple result sets will be returned? Thanks! 回答1: AFAIK, you can't handle multiple result sets with hibernate.

BLToolkit: Multiple resultsets?

不问归期 提交于 2019-12-10 06:49:50
问题 I haven't found a way to retrieve two lists of objects from an SP with two select statements. Is it possible with BLToolkit, or can only hierarchical data be fetched in such a manner? I'm trying to replace a dataset containing two unrelated tables. 回答1: It turns out it was really simple. :) Here's how you return multiple unrelated resultsets using BLToolkit. List<Apple> apples = new List<Apple>(); List<Orange> oranges = new List<Orange>(); MapResultSet[] sets = new MapResultSet[2]; sets[0] =

Hibernate: Multiple Result Sets

你说的曾经没有我的故事 提交于 2019-12-05 21:11:47
from what I've read in the Hibernate documentation/online it sounds like Hibernate does not have the ability to handle multiple result sets. I'm looking to make a MySQL DB call in an application that relies on Hibernate, that will return multiple result sets. What solutions have you used that "play well" with Hibernate, keeping in mind it's likely this will be the only call where multiple result sets will be returned? Thanks! AFAIK, you can't handle multiple result sets with hibernate. But I don't think you need it - multiple result sets can rarely map to results like List<FooEntity> . You can

BLToolkit: Multiple resultsets?

梦想与她 提交于 2019-12-05 16:24:21
I haven't found a way to retrieve two lists of objects from an SP with two select statements. Is it possible with BLToolkit, or can only hierarchical data be fetched in such a manner? I'm trying to replace a dataset containing two unrelated tables. It turns out it was really simple. :) Here's how you return multiple unrelated resultsets using BLToolkit. List<Apple> apples = new List<Apple>(); List<Orange> oranges = new List<Orange>(); MapResultSet[] sets = new MapResultSet[2]; sets[0] = new MapResultSet(typeof(Apple), apples); sets[1] = new MapResultSet(typeof(Orange), oranges); //Make sure

To write the value from resultset to text file (.txt file)

核能气质少年 提交于 2019-12-01 12:29:57
问题 Please help me on the below code as i want to write the values from the resultset to a txt file Code while (rs.next()){ FileWriter fstream = new FileWriter(file); BufferedWriter out = new BufferedWriter(fstream); out.write(Integer.toString(rs.getInt("SBL_PRODUCT_ID")) + ", "); out.write(Integer.toString(rs.getInt("SBL_TARIFF_ID")) + ", "); out.write(rs.getString("PRODUCT_DESCRIPTION") + ", "); out.write(rs.getString("SERVICE_TYPE") + ", "); out.write(Integer.toString(rs.getInt("MARKET_CLASS")

MyBatis multiple resultsets

*爱你&永不变心* 提交于 2019-11-29 12:21:52
I am currently migrating code from iBatis 2 to MyBatis 3. I have a function that returns multiple results sets which we map to different classes. In iBatis we where able to map the different results using a comma separated list int the resultType like so: <select id="findCashItems" parameterType="map" resultType="AdminCashBalance, AdminCashMovement, AdminCashTrx"> exec RequestActualAdministrativeData #{portfolioId} </select> But this does not appear to work in MyBatis 3. I can't find anything in the documentation except for a configuration item that, by default, enables multiple resultsets.

Linq to SQL Stored Procedures with Multiple Results

不打扰是莪最后的温柔 提交于 2019-11-28 19:35:32
We have followed the approach below to get the data from multiple results using LINQ To SQL CREATE PROCEDURE dbo.GetPostByID ( @PostID int ) AS SELECT * FROM Posts AS p WHERE p.PostID = @PostID SELECT c.* FROM Categories AS c JOIN PostCategories AS pc ON (pc.CategoryID = c.CategoryID) WHERE pc.PostID = @PostID The calling method in the class the inherits from DataContext should look like: [Database(Name = "Blog")] public class BlogContext : DataContext { ... [Function(Name = "dbo.GetPostByID")] [ResultType(typeof(Post))] [ResultType(typeof(Category))] public IMultipleResults GetPostByID(int

Dapper.NET and stored proc with multiple result sets

不想你离开。 提交于 2019-11-26 13:04:49
Is there any way to use Dapper.NET with stored procs that return multiple result sets? In my case, the first result set is a single row with a single column; if it's 0 then the call was successful, and the second result set will contain that actual rows/columns of data. (and if it was non-zero, an error occured and no second result set will be provided) Any chance to handle this with Dapper.NET? So far, I'm only ever getting back that single 0 - but nothing more. Update: OK, it works fine - as long as the result set no. 2 is a single entity: Dapper.SqlMapper.GridReader reader = _conn