[
https://issues.apache.org/jira/browse/EMPIREDB-227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14907907#comment-14907907
]
Rainer Döbele commented on EMPIREDB-227:
----------------------------------------
Hi Ivan,
thanks a lot for your contribution.
The code looks promising, although I think we can make further improvements.
What I did not like was the tedious and error-prone copying of each individual
property between the entity-bean and the record in the class EmployeeDaoImpl.
For this Empire-db provides two methods record.getBeanProperties(entitiy) and
record.setBeanValues(entity).
Unfortunately there were two problems with the current implementation:
1. as the entities did not have getters and setters for all columns an
exception was thrown.
2. the implementation did not deal correctly with the enumeration.
To get around this, I have added two new classes EmpireRecord and EmpireReader
in which I overrided the methos for getting and setting bean properties.
Then I was able to get rid of the necessity to copy each value separately.
The only thing that still remains is references to other entities (e.g.
result.setDepartment(departmentMapper.read(record)))
These are still handeld in EmployeeDaoImpl.
Now I think it would be great if these relationships could be handled
automatically in EmpireRecord and EmpireReader which would make the
implementation of the Dao even simpler.
Let me know what you think.
Regards
Rainer
> Spring Integration
> ------------------
>
> Key: EMPIREDB-227
> URL: https://issues.apache.org/jira/browse/EMPIREDB-227
> Project: Empire-DB
> Issue Type: Improvement
> Reporter: Ivan Nemeth
> Attachments: empire-db-spring.zip
>
>
> Starting point for a Spring-Empire integration. Code is based on Spring's
> JdbcTemplate model.
> There are corresponding classes for Spring's RowMapper, RowCallbackHandler
> and ResultSetExtractor (EmpireDataReader, EmpireRowCallbackHandler,
> EmpireReaderExtractor).
> Two examples is inculeded:
> SampleSpringApp does the same as the spring example I've found on Git.
> EmployeeApp: on the same db but with a different apporach (dummy ORM style)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)