Java

Java is a set of computer software and specifications developed by Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cross-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones to enterprise servers and supercomputers.

123

Friday, February 27, 2015

Exception in thread "main" org.hibernate.MappingException: Cannot use identity column key generation with mapping for:

Exception in thread "main" org.hibernate.MappingException: Cannot use identity column key generation with <union-subclass> mapping for: com.varasofttech.pojo.table_per_concrete_class.PermanentEmployee at org.hibernate.persister.entity.UnionSubclassEntityPersister.<init>(UnionSubclassEntityPersister.java:96) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)...

org.hibernate.MappingException: Unknown entity

Problem:This exception will occur mainly because of the following two reasons1. Making the @Entity with the wrong annotationimport org.hibernate.annotations.Entity; @Entitypublic class Employee implements Serializable { ...}solution for this one is changing the package name.import javax.persistence.Entity;2. Missing the @Entity annotationpublic class Employee implements Serializable { ...}solution for this one is adding the @Entity annotation to the class.import javax.persistence.Entity;@Entitypublic class Employee implements Serializable...

Thursday, February 26, 2015

Tomcat Remote debugging from Eclipse

To enable debug on tomcat, set the following line in your catalina.batDEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=nFrom your eclipse, create a Run Configuration for 'Remote Java Application' on socket 8000 and restart tomc...

Wednesday, February 4, 2015

Hibernate4 Logging Configuration Example

Hibernate 4.0 onwords for logging the information, JBoss Logging library are used. It is similar to SLF4J, Jakarta's Common logging, it is "logging bridge" provides the integration with several logging frameworks (Log4J, SLF4j, JDK Logging). Hibernate people is chosen JBoss Logging because it supports the I18N and support for "Message ids".Step1: Create a Maven projectCreate a maven project using one of your favorite IDE. Here i used Intellij Idea.Step2: Update the Maven DependenciesUpdate pom.xml file to include...

Monday, February 2, 2015

The method getDispatcherType() is undefined for the type HttpServletRequest

An error occurred at line: [42] in the generated java file: [D:\Upgrade\Upgrade_Eclipse_Worlspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\Spring4Hiberante4Integration\org\apache\jsp\WEB_002dINF\pages\employeeList_jsp.java]The method getDispatcherType() is undefined for the type HttpServletRequestSolution:<dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId>...