Spring Persistence — A Running Start by Paul Fisher, Solomon Duskis
By Paul Fisher, Solomon Duskis
Read Online or Download Spring Persistence — A Running Start PDF
Similar nonfiction_3 books
Adenosine Receptors and Parkinson's Disease
This e-book is the 1st definitive evaluation on adenosine receptor antagonists and their software to the therapy of Parkinson's sickness. The influence of those novel non-dopamine medications on vitro and in vivo platforms essentially indicates their power for the remedy of this debilitating illness. This e-book covers how the Parkinson's disorder antagonist drug, A2A, has been researched, constructed, and proven.
- Cycling Past 50 (Ageless Athlete Series)
- Escapement
- Emily Murphy: Rebel: first female magistrate in the British Empire
- Chemistry (Instant Revisions)
- [Magazine] Scientific American. Vol. 275. No 1
- Deathlands 03 Neutron Solstice
Extra resources for Spring Persistence — A Running Start
Sample text
JdbcTemplate = new JdbcTemplate(dataSource); } } The preceding snippet defines the scaffolding of the JDBC implementation for our PersonDao interface. Once the datasource reference is injected (via setter injection), we instantiate a JdbcTemplate instance and assign it to our private jdbcTemplate member variable. JdbcPersonDao">
In an art gallery application, you’ll find domain model objects called Person, Exhibtion, Artwork and ArtCategory. The domain model objects will consist of information that’s important to it. For example, a person has a firstName and a lastName. Domain model objects can also have relationships to other domain model objects. For example, an Artwork object may have one or more ArtCategory objects that apply to it. Let’s model the Person class as follows: public class Person implements Serializable { public Integer ADMIN_ROLE_LEVEL = 1; public Integer USER_ROLE_LEVEL = 2; private Long id; private String firstName; private String lastName; private String username; private String password; private Integer roleLevel; private Integer version; public Person() { Spring Persistence: A Running Start 23 } …(Getters and setters omitted) } The DAO Layer The goal of the DAO layer is to completely abstract the datasource and ways in which it loads, saves, and manipulates the data at hand.
It’s easy to understand now how this concept will allow us to employ multiple strategies to access a datasource without tying ourselves down to a particular solution. If you use the JndiObjectFactoryBean (a factory bean for resolving JNDI datasources), you will still end up with a DataSource reference, and the same will occur if you choose to use the PooledDatasource implementation. There are other reasons to use a Factory-Bean in Spring, as well. For instance, a MapFactoryBean can be utilized to create a Java Map, entirely in your configuration file (which can be quite convenient in certain cases).