Thursday, April 30, 2009

Use of the same entity name twice

I faced an exception while using jpa:

"Use of the same entity name twice"

The exception occured due to the existence of two classes with @Entity have the same name


@Entity ( name="BeanName")
The Entity annotation has attribute called name which is the name of the entity ,its default value is the class name
@table( name="tableName")
The table annotation has attribute called name which is the name of the table ,its default value is the entity name ,and if there is no entity name,then the default will be class name


So the problem in this exception that I used @Entity giving the two entities the same name,and there is problem in that because the container uses the entities names to uniquely identify them and therefore the solution is to use @table and make the two enties use the same table name but use different entity name.

Saturday, April 18, 2009

EGJUG day

Today I have attended the EGJUG day.
First session by Ahmed Hashim was about the EGJUG and its objectives, JDC (Java Developer Conference) and its objectives, how they arrange for it, etc …

Second session was about Spring Security (Acegi), the speaker talked about Spring Security which is a project that introduce services that enhance the jEE security
Then he talked about Spring Security Features like
-Web URL authentication
- Method Authentication Invocation
- Channel Security
- Human user detection
- LDAP support
- JSP Tag Library support
- Support for SSO
- Integration with Servlet container Authentication
Then he talked about Spring Security vs. JEE security. JEE security is container dependant, it is not easy for testing, and advanced authentication is missing.
Then he made simple example using spring security in authentication by user name and password.
Then he made another example about security on methods. This is done by using annotations.

Third session was about Web UI- Dev tools.
Speaker talked about the objectives of these tools which are, Inspecting HTML DOM, Debugging JavaScript, CSS issues, HTML sniffing , Fixing Errors.
He introduced examples of Firefox tools such as FireBug which is a great tool which enable us to test, debug and edit HTML, CSS and JavaScript files, ColorZilla which display the color of the pixel currently under the mouse, JSView which is a tool enable you to see the source code of external files like JS, CSS, etc, Measurelt which draw a ruler across any web page to check the width, height, etc, LiveHttpHeaders which is used for HTTP sniffing.
And also he introduced an IE tool which is IE Dev toolbar (Internet Explorer Developer toolbar).

Fourth session was about AOP (Aspect Oriented Programming).the speaker talked about the need for AOP and that it is used to enable separation of concerns. This is done by breaking down the program into separate parts which are concerns.
He talked about the crosscutting problem. This is when some concern crosscut many parts in the system. Example of this is logging, security.
OOP (Object Oriented Programming) fail with crosscutting problems.
But AOP solve this problem by making separation of concerns.
AOP also solves the problems of low cohesion and tight coupling.
AOP saves the developer time in rewriting the same code.
AOP is a concept and AspectJ is an implementation for that concept.