Compilation Error while generating hibernate entities using JBDS and forge.
Issue
-
Use
JBDS 8CR1
,forge
andangular js
to generate the code. -
Follow below steps to simulate the error:
- Create new project using forge
- Add JPA setup
- Create entities from tables option which generate model for the 2 tables
CREATE TABLE stock (
STOCK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
STOCK_CODE VARCHAR(10) NOT NULL,
STOCK_NAME VARCHAR(20) NOT NULL,
PRIMARY KEY (STOCK_ID) USING BTREE,
UNIQUE KEY UNI_STOCK_NAME (STOCK_NAME),
UNIQUE KEY UNI_STOCK_ID (STOCK_CODE) USING BTREE
);
CREATE TABLE stock_detail(
STOCK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
COMP_NAME VARCHAR(100) NOT NULL,
COMP_DESC VARCHAR(255) NOT NULL,
REMARK VARCHAR(255) NOT NULL,
LISTED_DATE DATE NOT NULL,
PRIMARY KEY (STOCK_ID) USING BTREE,
CONSTRAINT FK_STOCK_ID1 FOREIGN KEY (STOCK_ID) REFERENCES stock(STOCK_ID)
)
- After creating entities using specified environment,
compilation error
is coming related tounresolved import statements
which is as below;
import cannot be resolved for import org.hibernate.annotations.GenericGenerator
import cannot be resolved for import org.hibernate.annotations.Parameter
- Entities are being generated automatically and
Hibernate annotations
are used for mapping. - As
hibernate-annotations.jar
is not included inclass-path or project lib
, it's showingcompilation errors for import statements
with respect tohibernate annotations
.
Environment
- Red Hat Jboss Developer Studio 8.x
- JBoss Forge 2.x
- JBoss Hibernate 3.5 onward
- MySQL Database 5.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.