[
http://jira.jboss.com/jira/browse/JBSEAM-2007?page=comments#action_12379739 ]
Dan Allen commented on JBSEAM-2007:
-----------------------------------
I could take care of this issue as long as I can get buy-in on the following statement.
Required:
Due to the fact that action classes are not in the same Java package as entity classes, a
star import will be required to import the model classes.
Reasoning:
I tried to figure out how to intelligently important just the entity classes that are
needed, but the assumption made by hibernate-tools that the class created by hbmtemplate
uses the same package name as the entity make it impossible to import arbitrary entity
classes.
Effect:
import com.company.model.*;
new-entity and generate-entities don't use same package name
------------------------------------------------------------
Key: JBSEAM-2007
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2007
Project: JBoss Seam
Issue Type: Bug
Components: Tools
Affects Versions: 2.0.0.CR1
Reporter: Dan Allen
Assigned To: Dan Allen
Fix For: 2.0.0.CR2
Attachments: JBSEAM-2007-v1.txt
Original Estimate: 30 minutes
Remaining Estimate: 30 minutes
The *Home.java and *List.java classes that are produced by new-entity do not use the same
package as the same classes produced by generate-entities.
Assuming the entity name is MyEntity, here is how the two actions play out.
new-entity:
src/action/com/company/action/MyEntityHome.java
src/action/com/company/action/MyEntityList.java
generate-entities:
src/action/com/company/model/MyEntityHome.java
src/action/com/company/model/MyEntityList.java
Notice that generate-entities uses "model" while the new-entity uses
"action".
This behavior is due to a limitation in the hbmtemplate task which assumes that the Java
files created will be in the same package as the model. However, it is possible to work
around this problem. I have created such a patch. I believe that new-entity exhibits the
correct behavior and puts the classes in the expected location.
The only limitation of doing this patch is that it is necessary to use a star import for
the model classes since the hbmtemplate task assumes the current package is the package of
the entity (hence even pojo.importType() wouldn't work). However, this shouldn't
really be an issue since the IDE can cleanup the star imports. I would much rather have
the consistency of the same package. Besides, *List.java and *Home.java are action
components, not models.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira