Spring DAO

Sunday, July 20, 2008

Spring DAO support has been improved in the latest FireStorm 4.0 beta, which is now available for download. Each Spring DAO method is now annotated as @Transactional and the spring configuration file specifies a DataSourceTransactionManager. By default the DAO finder methods now return typed lists e.g. List<Customer> rather than arrays.

There are some improvements to Spring MVC support as well. FireStorm now generates a single controller per table which extends MultiActionController.

Labels:

2 Comments:

Anonymous Anonymous said...

You have a very nice tool.

I downloaded the beta version for testing purposes and i have 2 questions:

1) If in the database i have master table and detail table and master_id is foreign key in detail table.

master
master_id
....
detail
detail_id
master_id (foreign key from master table)



the generated jdbc classes or spring ones the DTO classes do not look like this:

public class Master

private List(details) details

...
---------------------------
public class Detail

private Master parent;




In the generated class there is

public class Master
//no ref to any detail list

public class Detail
int master_id;



This approach is not very Object oriented.Is there a way to achieve a OO way ?

Should I modify the code by hand ?

October 24, 2008 4:49 AM  
Blogger Andy Grove said...

You need to decide if you want DAO or if you really want ORM. FireStorm does support both. If you want to use an ORM then you can generate Hibernate or JPA code with Hibernate. If you want to use DAO then you have a choice of Spring JDBC or regular JDBC.

This post might help you decide:

/weblog/andygrove/archives/2005/02/data_access_obj.html

October 24, 2008 7:34 AM  

Post a Comment

<< Home