[JBoss Seam] - seam-gen generate entities errors
by bdlink
Saw something similar in JIRA regarding Temporal fields, but that is not an issue here.
Running Seam 2.0.0.CR2 with JDK 1.5.0_12 and JBoss4.2.1.GA and eclipse3.3.1 with JBoss Tools2.0.0.beta4 installed.
Created a new project with seamgen new-project with the following properties:
| #Generated by seam setup
| #Sun Oct 21 13:21:48 PDT 2007
| hibernate.connection.password=changed
| workspace.home=C\:/Documents and Settings/blink/workspace33
| model.package=ca.bcit.infosys.entity
| hibernatetool.metadatadialect=org.hibernate.cfg.reveng.dialect.MySQLMetaDataDialect
| driver.jar=lib/mysql-connector-java-5.0.7-bin.jar
| action.package=ca.bcit.infosys.session
| test.package=ca.bcit.infosys.test
| database.type=mysql
| richfaces.skin=blueSky
| hibernate.default_catalog.null=
| hibernate.default_schema.null=
| database.drop=n
| project.name=infosys
| hibernate.connection.username=changed
| hibernate.connection.driver_class=com.mysql.jdbc.Driver
| hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
| project.type=ear
| icefaces.home=
| database.exists=y
| jboss.home=C\:/apps/jboss-4.2.1.GA
| hibernate.dialect=org.hibernate.dialect.MySQLDialect
| hibernate.connection.url=jdbc\:mysql\://localhost\:3306/infosys
|
then generated entities from the mysql database. No errors from seamgen script.
Code generated did not compile due to duplicate names (the type was used instead of the column name for the variable name - column name would be better). After fixing this so it would compile, project would not deploy.
Error:
| 11:40:40,929 INFO [SchemaValidator] Running schema validator
| 11:40:40,929 INFO [SchemaValidator] fetching database metadata
| 11:40:40,999 INFO [TableMetadata] table found: infosys.review
| 11:40:40,999 INFO [TableMetadata] columns: [comments, ratepersonal3, reviewer, rateleadership4, tech4, ratepersonal4, ratetask1, id, ratepersonal5, ratetech1, ratetask3, ratetask6, rateleadership2, ratepersonal2, tech3, summary, period, received, ratetask8, ratepersonal7, reviewtype, ratetech2, rateleadership1, ratetask5, ratepersonal8, ratetask7, ratetask2, rateleadership3, tech1, ratetech4, year, pos, ratepersonal1, employee, ratepersonal6, ratetech3, tech2, ratetask4]
| 11:40:41,009 WARN [ServiceController] Problem starting service persistence.units:ear=infosys.ear,unitName=infosys
| javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: id, expected: varchar(32)
| at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)
| at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
| at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
|
The generated annotation for the Review class is as follows:
| @Entity
| @Table(name = "review", catalog = "infosys")
| public class Review implements java.io.Serializable {
|
| private String id;
| ...
| @Id
| @Column(name = "id", unique = true, nullable = false, length = 32)
| @NotNull
| @Length(max = 32)
| public String getId() {
| return this.id;
| }
| ...
|
Following is the schema of the review table:
| CREATE TABLE `review` (
| `id` char(32) NOT NULL,
| `employee` varchar(32) default NULL,
| `pos` varchar(20) default NULL,
| `reviewer` varchar(32) default NULL,
| `received` datetime default NULL,
| `period` tinyint(4) default NULL,
| `year` smallint(4) unsigned default NULL,
| `reviewType` varchar(20) default NULL,
| `tech1` varchar(35) default NULL,
| `rateTech1` tinyint(3) unsigned default NULL,
| `tech2` varchar(35) default NULL,
| `rateTech2` tinyint(3) unsigned default NULL,
| `tech3` varchar(35) default NULL,
| `rateTech3` tinyint(3) unsigned default NULL,
| `tech4` varchar(35) default NULL,
| `rateTech4` tinyint(3) unsigned default NULL,
| `rateTask1` tinyint(3) unsigned default NULL,
| `rateTask2` tinyint(3) unsigned default NULL,
| `rateTask3` tinyint(3) unsigned default NULL,
| `rateTask4` tinyint(3) unsigned default NULL,
| `rateTask5` tinyint(3) unsigned default NULL,
| `rateTask6` tinyint(3) unsigned default NULL,
| `rateTask7` tinyint(3) unsigned default NULL,
| `rateTask8` tinyint(3) unsigned default NULL,
| `ratePersonal1` tinyint(3) unsigned default NULL,
| `ratePersonal2` tinyint(3) unsigned default NULL,
| `ratePersonal3` tinyint(3) unsigned default NULL,
| `ratePersonal4` tinyint(3) unsigned default NULL,
| `ratePersonal5` tinyint(3) unsigned default NULL,
| `ratePersonal6` tinyint(3) unsigned default NULL,
| `ratePersonal7` tinyint(3) unsigned default NULL,
| `ratePersonal8` tinyint(3) unsigned default NULL,
| `rateLeadership1` tinyint(3) unsigned default NULL,
| `rateLeadership2` tinyint(3) unsigned default NULL,
| `rateLeadership3` tinyint(3) unsigned default NULL,
| `rateLeadership4` tinyint(3) unsigned default NULL,
| `summary` tinyint(3) unsigned default NULL,
| `comments` text,
| PRIMARY KEY (`id`),
| KEY `employee` (`employee`),
| KEY `reviewer` (`reviewer`),
| CONSTRAINT `review_ibfk_1` FOREIGN KEY (`employee`) REFERENCES `student` (`id`),
| CONSTRAINT `review_ibfk_2` FOREIGN KEY (`reviewer`) REFERENCES `student` (`id`)
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
The names chosen for the foreign keys are studentForEmployee and studentForReviewer. Although these work, just using the column names of employee and reviewer would be preferable.
The code create in ReviewHome is also in error (as mentioned above):
@Name("reviewHome")
| public class ReviewHome extends EntityHome<Review> {
|
| @In(create = true)
| StudentHome studentHome;
| @In(create = true)
| StudentHome studentHome;
| ...
| public void wire() {
| Student studentByEmployee = studentHome.getDefinedInstance();
| if (studentByEmployee != null) {
| getInstance().setStudentByEmployee(studentByEmployee);
| }
| Student studentByReviewer = studentHome.getDefinedInstance();
| if (studentByReviewer != null) {
| getInstance().setStudentByReviewer(studentByReviewer);
| }
| }
|
|
Here there is no mention (in the instance variables) that one of these is to correspond to the employee column, the other to the review column. What would be reasonable to do here is a good question.
Any suggestions on how to get the project to deploy? My next step is to dig into hibernate and jboss docs to turn on more logging to see what specifically it is complaining about.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097610#4097610
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097610
18Â years, 8Â months
[JBoss Portal] - IPC: having the action from one portlet be processed by both
by doranen
Hi,
I am building 2 IPC portlets where I want one portlet to send messages to a different portlet in the same page, but also have the action be processed by the originating portlet (to save portlet preferences).
I am building off of the IPC example in the docs where I create an action URL in the originating portlet which gets listened to by the second portlet.
I am able to see the message appear in the second portlet, but apparently, the processAction method of the originating portlet is not called. Does the second portlet intercept the action and not allow the processAction of the first portlet to be called? Is there a way around this so the request gets posted to both portlets?
Thanks for your help!
JBoss Portal Version : 2.6.2 Bundled
Downloaded Portal, not from CVS
JBoss AS Version: 4.2.1
Database Vendor and Version: built-in
JDBC Connector and Version: built-in
OS Platform: Windows XP Pro
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097596#4097596
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097596
18Â years, 8Â months