MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
nuspy
Post subject: Scaffolding from POJO domain class not working  PostPosted: Mar 14, 2011 - 02:33 AM



Joined: Mar 14, 2011
Posts: 8

Hi all.
I am trying MyEclipse from a couple of days, and I am stucked..
I can´t scaffold starting from domain to a Database.
I have seen a lot of tutorials that make reverse engineering (Database to domains, DAO) but noone from Domain Class to Database.
This is what I make:

1) create the domain classes (for commodity just say one only, named Car)
2) the content is pretty basic, just to try:
private long Id;
private String model;
3) I generated getters and setters (Source, generate...)
4) MyEclipse - > Add JPA Capabilities
- select TopLink. Next
- specify the data source to MySQL (prec. created Driver & Catalog/Schema), then enable dynamic DB table creation. Finish (this point has been avoid in another test, with same failure)
5) MyEclipse - > Add JPA Annotation
- annotate fields. Finish.
In the domain class have been generated the imports (import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.Id;
), @entity, @id and@GeneratedValue.
6) MyEclipse - > Scaffold Spring CRUD Application
- select JPA Entities. Next
- add Car domain. Next
- Package com.test
(selected: scaffold web layer, Service layer, DAO). Next
- Select DB connection previously setted (MySQL) Next
- select Spring MVC Scaffolding. Next
- Next (in personalize UI)
- Next (in select Target Folder, using default ones)
- Summary -> Finish.

A lot of libraries, DAO files, controllers, service Layers have been added.
But the database has not been created.
What I make wrong? How database table will be generated?

Thank you for your help... if I solve that I will by sure subscribe to MyEclipse!
 
 View user's profile Send private message  
Reply with quote Back to top
support-swapna
Post subject: RE: Scaffolding from POJO domain class not working  PostPosted: Mar 14, 2011 - 06:05 AM



Joined: Nov 11, 2010
Posts: 2149

nuspy,

1) Can you share your installation details with us from MyEclipse > Installation Summary > Installation Details? Please paste them here for me.

2) Do you see any errors of interest logged in the .log file which is located at < workspace dir>/.metadata folder ? If yes then paste them here.

Here is a thread which discusses forward engineering. Have a look and check if it helps you.
http://www.myeclipseide.com/PNphpBB2-viewtopic-p-118857.html

Let me know how it works for you.

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
nuspy
Post subject: RE: Scaffolding from POJO domain class not working  PostPosted: Mar 14, 2011 - 09:37 AM



Joined: Mar 14, 2011
Posts: 8

Hi, thank you for the answer.
This is my installation detail:

*** Date:
lunedì 14 marzo 2011 9.24.43 CET
** System properties:
OS=WindowsVista
OS version=6.1.0
Java version=1.6.0_13
*** MyEclipse details:
MyEclipse Enterprise Workbench
Version: 8.6.1
Build id: 8.6.1-20101117
*** Eclipse details:
MyEclipse for Spring
Version: 8.6

Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-showsplash
-launcher
C:\Users\Pluto\AppData\Local\Genuitec\MyEclipse for Spring 8.6 2\myeclipseforspring.exe
-name
Myeclipseforspring
--launcher.library
C:\Users\Pluto\AppData\Local\Genuitec\MyEclipse for Spring 8.6 2\../Common/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519\eclipse_1206.dll
-startup
C:\Users\Pluto\AppData\Local\Genuitec\MyEclipse for Spring 8.6 2\../Common/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
-install
C:\Users\Pluto\AppData\Local\Genuitec\MyEclipse for Spring 8.6 2
-configuration
C:\Users\Pluto\AppData\Local\Genuitec\MyEclipse for Spring 8.6 2\configuration
-vm
C:/Users/Pluto/AppData/Local/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin/client/jvm.dll



Yes, I notice an error that seems relevant:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MotorDAO': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Nuovo_MySQL' defined in class path resource [Scaff_2-generated-dao-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No persistence unit with name 'Nuovo_MySQL' found
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:341)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1055)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:825)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:767)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:685)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
... 39 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Nuovo_MySQL' defined in class path resource [Scaff_2-generated-dao-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No persistence unit with name 'Nuovo_MySQL' found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.orm.jpa.EntityManagerFactoryUtils.findEntityManagerFactory(EntityManagerFactoryUtils.java:99)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findNamedEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:510)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:492)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:656)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:629)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:147)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:338)
... 50 more
Caused by: java.lang.IllegalArgumentException: No persistence unit with name 'Nuovo_MySQL' found
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.obtainPersistenceUnitInfo(DefaultPersistenceUnitManager.java:386)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.determinePersistenceUnitInfo(LocalContainerEntityManagerFactoryBean.java:244)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:196)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1400)
... 64 more

Thank you
 
 View user's profile Send private message  
Reply with quote Back to top
jkennedy
Post subject: RE: Scaffolding from POJO domain class not working  PostPosted: Mar 30, 2011 - 02:40 PM



Joined: Jan 27, 2010
Posts: 245

nuspy,
Can you send me your project at jkennedy@skywaysoftware.com if you have not found the resolution to this issue.

It looks like the Persistence Unit is not defined in the DAO context file.

Sorry for the delay,
Jack
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits