describing its parameter object and is therefore not type-safe and its use is subject to many syntax errors.
GraniteDS provides a Java-like reflection API that encapsulates describeType calls and offers a type-safe, object-oriented, set of
reflection classes and methods
caches its results for better performance
supports advanced features such as ApplicationDomain
and namespaces
differences between CDI beans and EJBs is that EJBs are :
Transactional
Remote or local
Able to passivate stateful beans freeing up resources
Able to make use of timers
Can be asynchronous
Stateless EJBs can be thought of as thread safe single-use beans that don’t maintain any state between two web requests
Stateful EJBs do hold state and can be created and sit around for as long as they are needed until they are disposed of
Stateless beans must have a dependent scope while a stateful session bean can have any scope. By default they are transactional, but you can use the transaction attribute annotation.
CDI beans can be injected into EJBs and EJBs can be injected into CDI beans
When to use which bean
How do you know when to use which bean? Simple.
In general, you should use CDI beans unless you need the advanced functionality available in the EJBs such as transactional functions. You can write your own interceptor to make CDI beans transactional, but for now, its simpler to use an EJB until CDI gets transactional CDI beans which is just around the corner
Comparing JSF Beans, CDI Beans and EJBs
JSF Managed Beans
In short, don’t use them if you are developing for Java EE 6 and using CDI. They provide a simple mechanism for dependency injection and defining backing beans for web pages, but they are far less powerful than CDI beans.
JSF beans cannot be mixed with other kinds of beans without some kind of manual coding.
CDI Beans
includes a complete, comprehensive managed bean facility
interceptors, conversation scope, Events, type safe injection, decorators, stereotypes and producer methods
JSF-like features, you can define the scope of the CDI bean using one of the scopes defined in the javax.enterprise.context package (namely, request, conversation, session and application scopes). If you want to use the CDI bean from a JSF page, you can give it a name using the javax.inject.Named annotation
GDS/Tide project represents the Data Services part of GDS
comparable to LiveCycle Data Services, which is neither open source nor free, as it provides similar features such as client container of managed entities, data paging, and integration with server components, but it is based on completely different principles:
All managed entity instances are unique in a Tide context
Tide keeps the classic three layers web architecture, when LCDS removes the service layer, and is some kind of remote JPA provider for Flex applications
Tide approach is to minimize the amount of code needed to make things work between the client and the server
principles are very similar to the ones of JBoss Seam, which is the main reason why the first integration of Tide has been done with this framework. Integrations with Spring, EJB 3 and CDI are also available
need to compile your MXML/AS sources with the granite-essentials.swc and granite.swc libraries
Granite Data Services provides a messaging feature, code name Gravity, implemented as a
Comet-like service with AMF3 data polling over HTTP
(producer/consumer based architecture)
GraniteDS messaging relies on two main AS3 components on the Flex side: org.granite.gravity.Consumer
and org.granite.gravity.Producer
6.3. Common Configuration
There are three main steps to configure Gravity in an application:
Declare the Gravity servlet implementation for your target server in web.xml
Declare a messaging service and destination in services-config.xml, mapped to a specific channel
definition of type GravityChannel
JPA applications that create an EntityManagerFactory on their own, either using the PersistenceProvider SPI directly or through an intermediary mechanism such as Spring's LocalContainerEntityManagerFactoryBean
standard Java EE-applications may ignore the provider implementation and rely on the standard features provided by the container - JBoss AS7 supporting standard JPA 1.0 and 2.0
future versions of JBoss AS7 it will be possible to use alternative persistence provider implementations
Due to the limited capabilities of the ActionScript 3 reflection API than cannot access private fields, it is necessary to create
an externalizable AS3 class (implementing flash.utils.IExternalizable and its corresponding externalizable Java class
writeExternal
In both classes you have to implement two methods
the Gas3 generator can automatically generate the writeExternal and readExternal methods.
With GraniteDS automated externalization and without any modification made to our bean, we may serialize all properties of the Person class,
private or not
In order to externalize the Person.java entity bean, we must tell GraniteDS which classes we want to externalize
with a
externalize all classes named com.myapp.entity.Person by using the org.granite.hibernate.HibernateExternalizer
you could use this declaration, but note that type in the example above
is replaced by
asks the user for multiple pieces of hard data that should have been
previously collected
send the password reset information to some
out-of-band side-channel
such as a (possibly different) email address or an SMS text number, etc. to be used in Step 3.
Step 2) Verify Security Questions
application verifies that each piece of data is correct for the given username
If anything is incorrect, or if the username is not recognized, the second page displays a generic error message such as “Sorry, invalid data”. If all submitted data is correct, Step 2 should display at least two of the user’s pre-established personal security questions, along with input fields for the answers.
Avoid sending the username as a parameter
Do not provide a drop-down list
server-side session
user's email account may have already been compromised
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?