|
Re: POJO generator from SQL query [message #527976 is a reply to message #527725] |
Sat, 17 April 2010 17:52 |
Walter Harley Messages: 847 Registered: July 2009 |
Senior Member |
|
|
"Kuba P." <jakub.pawlowski@zilp.lasy.gov.pl> wrote in message
news:hq99dj$6f2$1@build.eclipse.org...
> I'm looking for Eclipse plugin that creates for me POJO class from native
> SQL query e.g:
>
> SELECT e.first_name,
> e.last_name,
> e.salary,
> d.department
> FROM emp e,
> dept d
> WHERE e.deptno = d.deptno
>
>
> This plugin should generate class like this:
>
> public class Employee{
>
> public Employee(){}
>
> private String firstName;
> private String lastName;
> private Number salary
> private String department;
>
> /* getters and setters here*/
> }
>
>
> I could use Hibernate tools but it generates only one POJO for one table,
> but I need to map more complex native queries.
I would suggest working with Hibernate. It is able to do very complex
stuff, you just need to learn how. But it will be easier to learn Hibernate
than to write your own SQL parser, if your queries are that complex. Plus,
if you use Hibernate you will be able to take advantage of its other
features, such as caching.
>
> If there is no that plugin is this very dificult to write my own ? How to
> start that. I mean following scenario:
>
> 1) From menu I could choose "Generate POJO from SQL query"
> 2) Then I could get a window with input areas to:
> - paste SQL
> - input pojo class name
> - choose package
> - choose connection from list defined in Database Developement
> perspective
>
> Its all. Thanks for help
> Kuba
|
|
|
|
Powered by
FUDForum. Page generated in 0.02722 seconds