history is persisted in the database
by means of a JPA entity bean and those objects are serialized back to the Flex client each time you enter a new name.
An alternative is if you are using a generic DAO class to handle entity persistence is to put the enhanced populateTimestamp method on there and call it prior to inserting or updating the entity in the DAO
discuss the rationale for migrating your applications from Spring to Java EE 6 and show you real examples of upgrading the web UI, replacing the data access layer, migrating AOP to CDI interceptors, migrating JMX, how to deal with JDBC templates, and as an added bonus will demonstrate how to perform integration tests of you Java EE 6 application using Arquillian
EntityManagerClinicTest
There is also an interesting Arquillian Persistence extension that integrates DBUnit in Arquillian where you can define your test data externally
JDBC Templates hardly give any abstraction on top of the database and you’re on your own for Object Relational Mapping. We strongly advise to use JPA wherever possible; it gives portability by abstracting most of the database specific SQL that you would need, and it does all the hard and painful work of object mapping
used
as a base class for JPA/Hibernate persisted permissions that wish to store the parts of the permission string
in separate columns (e.g. 'domain', 'actions' and 'targets' columns)
key ingredients of a service-oriented component:
Facade: Provides simplified, centralized access to the component and decouples the client from the concrete services. It is the
network and transaction boundary.
Service: The actual implementation of business logic.
Domain structure: This is a structure rather than an object. It implements the component's persistence and exposes all of its state to the
services, without encapsulation.
This convention not only standardizes the structure and improves maintainability, but also allows automatic dependency validation
with frameworks like JDepend, Checkstyle, Dependometer, SonarJ, or XRadar. You can even perform the validation at build time. If you do, the continuous build would break on violation of defined dependencies.
The rules are clearly defined with strict layering: a facade may access a service, and the service a domain object, but not
vice versa
When the application inserts or updates an object, it will set these fields and they will be stored in the database. JPA events could also be used to record the audit information, or to write to a separate audit table.
How To Deal With Interfaces In Java EE 6 (or no more Impl)
In Java EE 6 interfaces became absolutely optional. Neither in EJB 3.1, nor CDI / JSR-330 you need interfaces. You can inject classes directly. They will be still proxied, so all aspects like persistence, transactions, interceptors, decorators are still available. So you are no more forced to implement interfaces by the container
used for:
Strategy Pattern: there are already several implementations of an algorithm or concept
Layering: there is a clear need to hide e.g. an ugly implementation of a legacy framework
API (not very common): you have to expose a API, which gets implemented by SPI (e.g. JDBC)
If you introduce interfaces intentionally - and not as a general rule, you will considerably reduce the number of files. Your code becomes easier to understand and so maintain
Even for decoupling purposes, interfaces are no more needed
"Contract First", "Coding To Interfaces" or "Decoupling"
is not a reason to introduce an interface for everything
Java Persistence API (JPA)
Java Contexts and Dependency Injection (CDI)
Java Authentication and Authorization Service (JAAS)
Java Authorization Contract for Containers (JACC)
JavaMail API
Bean Validation
Enterprise JavaBeans
stop asking themselves how this solution could be improved upon
It's a very impressive magic trick, and I wish I knew how to do it myself. But then, I'm just not like that. I'm always trying to poke holes in things - whether they were Invented Here or Not.
but that might be too high-level for your taste. Their are other, less-abstract options.
exception handling, this is one area where Spring does a good job: "The Spring Framework's handling of SQLException is one of its most useful features in terms of enabling easier JDBC development and maintenance. The Spring Framework provides JDBC support that abstracts SQLException and provides a DAO-friendly, unchecked exception hierarchy."
Utter nonsense and dishonest false advertising
Automatic connection closing (and other boiler-plate code) is obviously a hard requirement to be handled by the fwk.
Pffffff. It's a trivial requirement which I can solve in my framework with two lines of code in a @Disposes method. Did you see any connection handling in the code above?
I mean, seriously guys. The Spring stuff is trivial and not even very elegant. I guess it's easier for me to see that, since I spent half my career thinking about data access and designing data access APIs. But even so...
I don't understand. You hate the ability to write typesafw SQL that much?
Gavin King
Methods with long argument lists are a code smell.
It's something Spring copied from Hibernate 1.x, back in the days before varargs
It's something we removed in Hibernate2 and JPA.
there are a bunch of people
who don't want to use JPA.
They don't understand, or see the value of, using managed objects to represent their persistent data.
Um. Why? Why would that be a bad thing? I imagine that any app with 1000 queries has tens of thousands of classes already. What's the problem? Why is defining a class worse than writing a method?
Are you working from some totally bizarre metric where you measure code quality by number of classes?