Spring Persistence — A Running Start by Paul Fisher, Solomon Duskis

By Paul Fisher, Solomon Duskis

Show description

Read Online or Download Spring Persistence — A Running Start PDF

Best nonfiction_3 books

The Barbary Corsairs: The End of a Legend, 1800-1820 (Ottoman Empire and It's Heritage) (v. 29)

From 1516 to 1830, the Barbary corsairs ruled the Ottoman provinces of Algiers, Tunis and Tripoli. The years among 1800-1820 have been the most important. till 1805, a astonishing revival of privateering permits the writer to provide the boys, the practices and the consequences received via the privateers. From 1805 to 1814, the Maghrib states gave up a superb a part of privateering on behalf of transportation and seaborne alternate, making the most of their neutrality through the Napoleonic wars.

Technology-Enhanced Systems and Tools for Collaborative Learning Scaffolding

Technology-Enhanced structures and instruments for Collaborative studying Scaffolding is an incredible study subject in CSCL and CSCW examine neighborhood. This ebook offers updated learn techniques for constructing technology-enhanced platforms and instruments to help sensible on-line collaborative studying and paintings settings.

Extra info for Spring Persistence — A Running Start

Sample text

Instead, we would probably combine the PersonDAO methods Person authenticateUser( String username, String password); with the RoleDAO methods: Role getRoleTypeForPersonId(Long userId); Together, these combined DAO methods accomplish a core business goal that is greater than the sum of its parts. In this example, we are using two read-only methods, but imagine a scenario in which we have a business method like so: Boolean transferMoney( Long amount, Account fromAccount, Account destAccount) throws InvalidPermissionException, NotEnoughFundsException; Now, assume that the preceding service layer method is composed of several DAO methods: Boolean validateSufficientFundsInAccount( Long accountId); Boolean removeFunds(Long accountId, Long amount); Boolean addFunds(Long accountId, Long amount); It’s easy to see what’s going on here: we verify that enough cash exists in a particular account and then pull the funds from one account and transfer them to the destination account.

UsingGeneratedKeyColumns("id"); } The preceeding code will instantiate our insertPerson member variable to be used for inserting new rows into the Person database. Notice that SimpleJdbcInsert uses method chaining, allowing multiple methods to be called sequentially on the same line. The withTable method must be passed the precise name of the table on which you plan to operate, as this is how metadata will be extracted (for instance, inferring the column names used within the table). The usingGeneratedKeyColumns method is optional, but it allows the SimpleJdbc class to rely on the database for generating a primary key for the newly inserted row.

Now, if we wanted to get a bit fancier, we could instead choose a popular database connection pool as our bean implementation. A connection pool is ideal for web applications in which multiple, concurrent database operations will be made. A connection pool can be optimized for different usage scenarios, ensuring a more efficient means for handing off new database connections to the application. Again, switching to a database connection pool will give our application more efficiency without requiring any code changes.

Download PDF sample

Rated 4.73 of 5 – based on 48 votes