Posts Tagged With ‘J2EE&8217

Security in Java EE Part 1

Object Oriented application development provides developers to divide application into different layers such as database layer, business layer, presentation layer … etc. Multi layer application development approach provides easy to develop and maintain large scale projects. However, this approach addresses one of the most important issue, security.

Java EE consists of components ejb, web, web services, application clients … etc. Each of these components can be deployed into different containers or same container. Security is handled by the containers; a container provides programming or declarative security. Programming security is embedded control mechanism that is used when declarative security is insufficient. Declarative security defines applications security configuration out of the application via configuration files. Also, annotations define set of security rules by class files.

Java provides some security implementation mechanisms like;


java.lang.OutOfMemoryError: PermGen space

If you are developing JEE applications with low resources (like me ) probably you have been facing “java.lang.OutOfMemoryError: PermGen space” exception and it will be your nightmare. Sample stack trace of exception:

StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
java.lang.OutOfMemoryError: PermGen space
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(
at sun.reflect.MethodAccessorGenerator$
at Method)
at sun.reflect.MethodAccessorGenerator.generate(
at sun.reflect.MethodAccessorGenerator.generateMethod(
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(

You should add these parameters to domail.xml to get rid of this exception ( it is not exact solution) :


Schema Generation : Hibernate vs Toplink

Do you know why I like hiberante and dislike toplink?
A simple reason should be hibernate scheme generation can update columns and lots of stuff in existing table as mentioned below:

SchemaExport (hbm2ddl): This tool is provided with the core Hibernate download. It uses Hibernate mapping metadata XML files to generate a SQL database schema with DDL. You can enhance your mapping files with database specific elements (SQL column datatypes, unique/check constraints/indexes, etc.) and then export the SQL DDL to a text file. You may also directly export the DDL to a database, this is very powerful in development, as you can automatically create and drop a database at each test run. See the Hibernate reference documentation for more information about this tool.

On the other hand, toplink can not update existing database table. It is terrible ….