Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is it good idea to create domain classes for temporary tables, if so, is how is possible

 
rama kammari
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a stored procedure in sql server , my goal is i need to parse that into java code , In procedure there are some physical and temporary tables involved , i created domain classes for physical tables, so can i also map domain classes with temporary table .
my procedure is

 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could create a class to represent the stored procedure result set. You would just need to map the class to the field names that the procedure returns (or use a result set mapping).

It would be a read-only entity. You could set the table name to just some dummy table name, or let it default.

You could also just execute the stored procedure without a result class. You would get an Object[] back, which you could then pass to a constructor for your class and assign the field values directly.
 
rama kammari
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you , i created one class that represents the result set of procedure, and i mapped properties of that class with procedure return results,
and i have list of files that represent #files (temporary table) , even though i have one more problem is that, there is a #files (temporary table) in the FROM Clause of Select Statement.
So How can i map this Files class with #files temporary table, is it possible to map? (because it is not physical table in database), so how can i achieve this using Java Code?
( or) please give me suggestions, How to write the java code(in spring jdbc) using domain(pojo) classes by mapping with physical and temporary tables for the above mentioned 'select query ' .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic