-
15. Re: Seam reverse engineering tool
vlasov01 Mar 8, 2006 10:51 PM (in response to gavin.king)Thomas,
Thank you a lot! Now it works after conversion to InnoDB.
I think it will be helpful to warn users in case if database is not 100% compatible. -
16. Re: Seam reverse engineering tool
vlasov01 Mar 8, 2006 11:00 PM (in response to gavin.king)Is it possible not to prefix class name with catalog name?
Example: tablece.users
result class nameCeUsers
.
Also I've noticed that *EditorBean is not using right method names, which is causing compilation errors.
Example:instance.getCeUsers().getCeProfiless().remove(instance); //error instance.getCeUsers().getCeProfileses().remove(instance); //fixed
-
17. Re: Seam reverse engineering tool
vlasov01 Mar 9, 2006 9:30 AM (in response to gavin.king)Please ignore my first question about class prefix and catalog name.
-
18. Re: Seam reverse engineering tool
max522over Mar 10, 2006 7:14 PM (in response to gavin.king)I can't find the hibernate-entitymanager.jar file in the nightly release? I can find it in my seam download and my jboss download but not in the nightly build download?
can someone direct me to where it is. I tried downloading the hibernate tools and it wasn't in there that I could find. -
19. Re: Seam reverse engineering tool
gavin.king Mar 11, 2006 4:18 AM (in response to gavin.king)hibernate-entitymanager.jar is not supposed to be in the Seam lib directory (you don't need it to compile Seam). It will be in embedded-ejb/lib.
-
20. Re: Seam reverse engineering tool
max522over Mar 11, 2006 5:31 AM (in response to gavin.king)thanks for the response.
I found the following file on the hibernate download all releases:
hibernate-entitymanager-3.1beta5.zip
which seemed to be the file you indicated in your first posting. I've got past my initial errors but now I'm getting the following exception
2006-03-11 03:40:22,281 WARN [org.jboss.system.ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=seamapp.ejb3
java.lang.NoSuchMethodError: org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(Ljava/net/URL;Ljava/util/Map;)Ljava/util/List;
at org.jboss.ejb3.Ejb3Deployment.initializePersistenceUnits(Ejb3Deployment.java:575)
at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:440)
at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:125)
at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
it declares this as a warning but then I get this at the end:
--- MBeans waiting for other MBeans ---
ObjectName: jboss.web.deployment:war=jboss-seam-hibernate.war,id=-709194412
State: FAILED
Reason: org.jboss.deployment.DeploymentException: URL file:/C:/Program Files/j
boss-4.0.4RC1/server/default/tmp/deploy/tmp55105jboss-seam-hibernate-exp.war/ de
ployment failed
ObjectName: jboss.j2ee:service=EJB3,module=seamapp.ejb3
State: FAILED
Reason: java.lang.NoSuchMethodError: org.hibernate.ejb.packaging.PersistenceXm
lLoader.deploy(Ljava/net/URL;Ljava/util/Map;)Ljava/util/List;
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.web.deployment:war=jboss-seam-hibernate.war,id=-709194412
State: FAILED
Reason: org.jboss.deployment.DeploymentException: URL file:/C:/Program Files/j
boss-4.0.4RC1/server/default/tmp/deploy/tmp55105jboss-seam-hibernate-exp.war/ de
ployment failed
ObjectName: jboss.j2ee:service=EJB3,module=seamapp.ejb3
State: FAILED
Reason: java.lang.NoSuchMethodError: org.hibernate.ejb.packaging.PersistenceXm
lLoader.deploy(Ljava/net/URL;Ljava/util/Map;)Ljava/util/List;
I traced the class to entitymanager.jar file? -
21. Re: Seam reverse engineering tool
gavin.king Mar 11, 2006 7:03 AM (in response to gavin.king)If you are running in JBoss, you should not be deploying your own versions of the jars! Just use what JBoss comes with.
-
22. Re: Seam reverse engineering tool
max522over Mar 13, 2006 3:41 AM (in response to gavin.king)gavin,
I appreciate you taking time to help me out. I'll be honest your last message didn't make any sense because I didn't think I was doing that. So I decided to delete jboss, jboss seam and eclipse and start over. I downloaded all the new stuff, then I downloaded that nightly build for the ide. I installed that and I was back to the isJndiName. I tried commenting out the offending line in the seam.properties file but that just gave me another error when I tried to run it. I finally discovered that I had to go in eclipse under help->software updates -> manage configuration and change each jboss product to use the nightly build by hand. that got me building, deploying and running.
Now I'm trying to figure out why mysql doesn't like my date time field format.
Thanks! -
23. Re: Seam reverse engineering tool
aristide Mar 24, 2006 2:09 AM (in response to gavin.king)Please, I´m trying for days to use reverse engineering for to generate a CRUD web application from a database using JBoss Eclipse IDE but i can´t because some errors when I deploy it at jboss-4.0.4rc1. Look this:
.
.
.
03:37:36,718 INFO [Component] Component: entityManager, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.ManagedPersistenceContext
03:37:36,718 ERROR [[/seamapp]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
java.lang.IllegalArgumentException: no property for configuration setting: entityManager.jndiName
at org.jboss.seam.Component.initInitializers(Component.java:250)
at org.jboss.seam.Component.(Component.java:186)
at org.jboss.seam.Component.(Component.java:143)
at org.jboss.seam.Component.(Component.java:138)
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:2
52)
at org.jboss.seam.init.Initialization.addComponents(Initialization.java:
190)
at org.jboss.seam.init.Initialization.init(Initialization.java:97)
at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.j
ava:31)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3692)
.
.
.
Someone can say what is happening and how to fix it?
Thanks a lot. -
24. Re: Seam reverse engineering tool
gavin.king Mar 24, 2006 6:28 PM (in response to gavin.king)Use the nightly build of Hibernate Tools.
-
25. Re: Seam reverse engineering tool
aristide Mar 25, 2006 10:38 PM (in response to gavin.king)Gavin, I try all day but I can´t to do it. How I upgrade nightly build of Hibernate Tools at JBoss Ide 1.5. Sorry if the question is so basic. Thanks or your support.
-
26. Re: Seam reverse engineering tool
thynamite Apr 6, 2006 11:57 AM (in response to gavin.king)I am also running into the same problem. Here is the stacktrace:
11:54:48,564 ERROR [[/seamapp]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
java.lang.IllegalArgumentException: java.beans.IntrospectionException: Method not found: isJndiName
at org.jboss.seam.Component.initInitializers(Component.java:267)
at org.jboss.seam.Component.(Component.java:187)
at org.jboss.seam.Component.(Component.java:142)
at org.jboss.seam.Component.(Component.java:137)
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:239)
at org.jboss.seam.init.Initialization.addComponents(Initialization.java:196)
at org.jboss.seam.init.Initialization.init(Initialization.java:93)
at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:30)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585) -
27. Re: Seam reverse engineering tool
max522over Apr 6, 2006 12:53 PM (in response to gavin.king)thynamite,
go here
http://download.jboss.com/jbosside/builds/nightly/buildResults.html
and download
JBossIDE-200604061020-nightly-ALL.zip
then unzip it into your eclipse directory.
then go into eclispe and for each jboss plugin switch it to the nightly build
help->software updates->manage configurations is the menu options to go through to get to the point where you can switch to using the nightly build
one thing to note. I've downloaded three different nightly builds. The first one worked great, the second one would not generate a hibernate.cfg file so we had to switch that plugin to original to generate the file and then switch back to generate the code with the isJndi error and the third nightly build would not deploy in eclipse.
This has fixed that error everytime. We have a team of 7 people using SEAM to build an application for our client and it's working great as soon as you can get a good nightly build. -
28. Re: Seam reverse engineering tool
mirko27 Apr 7, 2006 12:31 PM (in response to gavin.king)The reverse engineering tool did create the right entity beans, but if entity class had manytomany mappings editorbean went crazy.
We have ManyToMany mapping where products have related products.
MySQL INNODB Table:
CREATE TABLE `product` (
`ID` int(11) NOT NULL auto_increment,
`NAME` varchar(255) NOT NULL default 'unknown',
`SHOWED` tinyint(1) NOT NULL default '0',
`CATEGORY_ID` int(11) NOT NULL default '0',
`PRICE` float NOT NULL default '0',
`VERSION` int(11) NOT NULL default '0',
PRIMARY KEY (`ID`),
KEY `NAME` (`NAME`),
KEY `SHOWED` (`SHOWED`),
KEY `PRICE` (`PRICE`),
KEY `CATEGORY_ID` (`CATEGORY_ID`),
CONSTRAINT `product_ibfk_1` FOREIGN KEY (`CATEGORY_ID`) REFERENCES `category` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `related_products` (
`ID` int(11) NOT NULL auto_increment,
`PRODUCT_ID` int(11) NOT NULL default '0',
`RELATED_ID` int(11) NOT NULL default '0',
PRIMARY KEY (`ID`),
KEY `PRODUCT_ID` (`PRODUCT_ID`),
KEY `RELATED_ID` (`RELATED_ID`),
CONSTRAINT `related_products_ibfk_1` FOREIGN KEY (`PRODUCT_ID`) REFERENCES `product` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `related_products_ibfk_2` FOREIGN KEY (`RELATED_ID`) REFERENCES `product` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Code:@Name("productEditor") @Stateful @Interceptors(SeamInterceptor.class) public class ProductEditorBean implements ProductEditor { @In(create=true) private EntityManager entityManager; @Valid private Product instance = new Product(); @TransactionAttribute(NOT_SUPPORTED) public Product getInstance() { return instance; } public void setInstance(Product instance) { this.instance = instance; } private boolean isNew = true; @TransactionAttribute(NOT_SUPPORTED) public boolean isNew() { return isNew; } public void setNew(boolean isNew) { this.isNew = isNew; } private String doneOutcome = "find"; public void setDoneOutcome(String outcome) { doneOutcome = outcome; } @In(required=false) private transient ProductFinder productFinder; @In private transient ResourceBundle resourceBundle; @Begin(join=true) @IfInvalid(outcome=Outcome.REDISPLAY) public String create() { if ( entityManager.find(Product.class, instance.getId())!=null ) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage( resourceBundle.getString("Product_id") + " " + resourceBundle.getString("AlreadyExists") ) ); return null; } entityManager.persist(instance); isNew = false; if (instance.getCategory()!=null) { instance.getCategory().getProducts().add(instance); } refreshFinder(); return "editProduct"; } @IfInvalid(outcome=Outcome.REDISPLAY) public String update() { refreshFinder(); return null; } @End(ifOutcome="find") public String delete() { entityManager.remove(instance); instance.getCategory().getProducts().remove(instance); refreshFinder(); return doneOutcome; } @End(ifOutcome="find") public String done() { if (!isNew) entityManager.refresh(instance); return doneOutcome; } private void refreshFinder() { if (productFinder!=null) productFinder.refresh(); } @Destroy @Remove public void destroy() {} @In(create=true) private transient CategoryEditor categoryEditor; public String category() { categoryEditor.setNew(false); categoryEditor.setInstance( instance.getCategory() ); categoryEditor.setDoneOutcome("editProduct"); return "editCategory"; } @Begin(join=true) public String selectCategory() { CONVERSATION.getContext().set("categorySelector", Component.getInstance("productCategorySelector", true) ); return "selectCategory"; } @DataModel public List getOffersList() { return instance == null || instance.getOffers()==null ? null : new ArrayList( instance.getOffers() ); } @DataModelSelection private Offer selectedOffer; @In(create=true) private transient OfferEditor offerEditor; public String createOffer() { offerEditor.setNew(true); offerEditor.setInstance( new Offer() ); offerEditor.getInstance().setProduct(instance); offerEditor.setDoneOutcome( "editProduct" ); return "editOffer"; } public String selectOffer() { offerEditor.setNew(false); offerEditor.setInstance( selectedOffer ); offerEditor.setDoneOutcome( "editProduct" ); return "editOffer"; } @DataModel public List getBilllinesList() { return instance == null || instance.getBilllines()==null ? null : new ArrayList( instance.getBilllines() ); } @DataModelSelection private Billline selectedBillline; @In(create=true) private transient BilllineEditor billlineEditor; public String createBillline() { billlineEditor.setNew(true); billlineEditor.setInstance( new Billline() ); billlineEditor.getInstance().setProduct(instance); billlineEditor.setDoneOutcome( "editProduct" ); return "editBillline"; } public String selectBillline() { billlineEditor.setNew(false); billlineEditor.setInstance( selectedBillline ); billlineEditor.setDoneOutcome( "editProduct" ); return "editBillline"; } @DataModel public List getRelatedProductsesForProductIdList() { return instance == null || instance.getRelatedProductsesForProductId()==null ? null : new ArrayList( instance.getRelatedProductsesForProductId() ); } @DataModelSelection private RelatedProducts selectedRelatedProducts; @In(create=true) private transient RelatedProductsEditor relatedproductsEditor; public String createRelatedProducts() { relatedproductsEditor.setNew(true); relatedproductsEditor.setInstance( new RelatedProducts() ); relatedproductsEditor.getInstance().setProduct(instance); relatedproductsEditor.setDoneOutcome( "editProduct" ); return "editRelatedProducts"; } public String selectRelatedProducts() { relatedproductsEditor.setNew(false); relatedproductsEditor.setInstance( selectedRelatedProducts ); relatedproductsEditor.setDoneOutcome( "editProduct" ); return "editRelatedProducts"; } @DataModel public List getRelatedProductsesForRelatedIdList() { return instance == null || instance.getRelatedProductsesForRelatedId()==null ? null : new ArrayList( instance.getRelatedProductsesForRelatedId() ); } @DataModelSelection private RelatedProducts selectedRelatedProducts; @In(create=true) private transient RelatedProductsEditor relatedproductsEditor; public String createRelatedProducts() { relatedproductsEditor.setNew(true); relatedproductsEditor.setInstance( new RelatedProducts() ); relatedproductsEditor.getInstance().setProduct(instance); relatedproductsEditor.setDoneOutcome( "editProduct" ); return "editRelatedProducts"; } public String selectRelatedProducts() { relatedproductsEditor.setNew(false); relatedproductsEditor.setInstance( selectedRelatedProducts ); relatedproductsEditor.setDoneOutcome( "editProduct" ); return "editRelatedProducts"; } @DataModel public List getEntriesList() { return instance == null || instance.getEntries()==null ? null : new ArrayList( instance.getEntries() ); } @DataModelSelection private Entry selectedEntry; @In(create=true) private transient EntryEditor entryEditor; public String createEntry() { entryEditor.setNew(true); entryEditor.setInstance( new Entry() ); entryEditor.getInstance().setProduct(instance); entryEditor.setDoneOutcome( "editProduct" ); return "editEntry"; } public String selectEntry() { entryEditor.setNew(false); entryEditor.setInstance( selectedEntry ); entryEditor.setDoneOutcome( "editProduct" ); return "editEntry"; } } package ee.digizone.entity; // Generated 7.04.2006 16:52:56 by Hibernate Tools 3.1.0 beta3 import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; /** * Product generated by hbm2java */ @Entity @Table(name="product" ,catalog="digizone" , uniqueConstraints = { } ) public class Product implements java.io.Serializable { // Fields private int id; private int version; private Category category; private String name; private boolean showed; private float price; private Set<Offer> offers = new HashSet<Offer>(0); private Set<Billline> billlines = new HashSet<Billline>(0); private Set<RelatedProducts> relatedProductsesForProductId = new HashSet<RelatedProducts>(0); private Set<RelatedProducts> relatedProductsesForRelatedId = new HashSet<RelatedProducts>(0); private Set<Entry> entries = new HashSet<Entry>(0); // Constructors /** default constructor */ public Product() { } /** minimal constructor */ public Product(int id, Category category, String name, boolean showed, float price) { this.id = id; this.category = category; this.name = name; this.showed = showed; this.price = price; } /** full constructor */ public Product(int id, Category category, String name, boolean showed, float price, Set<Offer> offers, Set<Billline> billlines, Set<RelatedProducts> relatedProductsesForProductId, Set<RelatedProducts> relatedProductsesForRelatedId, Set<Entry> entries) { this.id = id; this.category = category; this.name = name; this.showed = showed; this.price = price; this.offers = offers; this.billlines = billlines; this.relatedProductsesForProductId = relatedProductsesForProductId; this.relatedProductsesForRelatedId = relatedProductsesForRelatedId; this.entries = entries; } // Property accessors @Id @Column(name="ID", unique=true, nullable=false, insertable=true, updatable=true) public int getId() { return this.id; } public void setId(int id) { this.id = id; } @Column(name="VERSION", unique=false, nullable=false, insertable=true, updatable=true) public int getVersion() { return this.version; } public void setVersion(int version) { this.version = version; } @ManyToOne(cascade={}, fetch=FetchType.LAZY) @JoinColumn(name="CATEGORY_ID", unique=false, nullable=false, insertable=true, updatable=true) public Category getCategory() { return this.category; } public void setCategory(Category category) { this.category = category; } @Column(name="NAME", unique=false, nullable=false, insertable=true, updatable=true) public String getName() { return this.name; } public void setName(String name) { this.name = name; } @Column(name="SHOWED", unique=false, nullable=false, insertable=true, updatable=true) public boolean isShowed() { return this.showed; } public void setShowed(boolean showed) { this.showed = showed; } @Column(name="PRICE", unique=false, nullable=false, insertable=true, updatable=true, precision=12, scale=0) public float getPrice() { return this.price; } public void setPrice(float price) { this.price = price; } @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.LAZY, mappedBy="product") public Set<Offer> getOffers() { return this.offers; } public void setOffers(Set<Offer> offers) { this.offers = offers; } @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.LAZY, mappedBy="product") public Set<Billline> getBilllines() { return this.billlines; } public void setBilllines(Set<Billline> billlines) { this.billlines = billlines; } @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.LAZY, mappedBy="productByProductId") public Set<RelatedProducts> getRelatedProductsesForProductId() { return this.relatedProductsesForProductId; } public void setRelatedProductsesForProductId(Set<RelatedProducts> relatedProductsesForProductId) { this.relatedProductsesForProductId = relatedProductsesForProductId; } @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.LAZY, mappedBy="productByRelatedId") public Set<RelatedProducts> getRelatedProductsesForRelatedId() { return this.relatedProductsesForRelatedId; } public void setRelatedProductsesForRelatedId(Set<RelatedProducts> relatedProductsesForRelatedId) { this.relatedProductsesForRelatedId = relatedProductsesForRelatedId; } @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.LAZY, mappedBy="product") public Set<Entry> getEntries() { return this.entries; } public void setEntries(Set<Entry> entries) { this.entries = entries; }
-
29. Re: Seam reverse engineering tool
mirko27 Apr 7, 2006 12:33 PM (in response to gavin.king)Basically It does not create entity bean right as well.
Thing is that it should take getRelatedProducts(); that returns products not relatedproducts table.