This is a bug that should be fixed.

http://issues.appfuse.org/browse/APF-794

On 2/22/08, Kropp, Henning <[EMAIL PROTECTED]> wrote:
> It's a Hibernate Exception:
>
>  Invocation of init method failed; nested exception is
>  org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany
>  targeting an unmapped class ..
>
>  Found a thread in the archive of this mailing list, that helped me. It's
>  that I have 2 hibernate.cfg.xml one in /src/test/resources
>  and the other in /main/resources.
>  In that Thread you mentioned it is a bug. Is there a fix solution yet?
>  Simple removing it in test/resources didn't not seem to resolve that
>  issue in the first place but does it now, after I have build the project
>  with a fixed hibernate.cfg.xml in test and after that removed it.
>
>  thx
>
>  Matt Raible schrieb:
>
> > You need to look in target/surefire-reports for *UserDaoTest.txt to
>  > find the error.
>  >
>  > Matt
>  >
>  > On 2/22/08, Kropp, Henning <[EMAIL PROTECTED]> wrote:
>  >
>  >> I can't use -Dsurefire.useFile=false, because:
>  >>
>  >>  [INFO] Invalid task '.useFile=false': you must specify a valid lifecycle
>  >>  phase, or a goal in the format plugin:goal or
>  >>  pluginGroupId:pluginArtifactId:pluginVersion:goal
>  >>
>  >>  But runnig mvn test -Dtest=UserDaoTest gives the following result:
>  >>
>  >>  -------------------------------------------------------
>  >>  Running com.bitpitch.dao.UserDaoTest
>  >>  INFO - AbstractSingleSpringContextTests.loadContextLocations(210) |
>  >>  Loading context for locations: classpath:/applicatio
>  >>  
> nContext-resources.xml,classpath:/applicationContext-dao.xml,classpath*:/applicationContext.xml,classpath:**/application
>  >>  Context*.xml
>  >>  Tests run: 8, Failures: 0, Errors: 8, Skipped: 0, Time elapsed: 1.11 sec
>  >>  <<< FAILURE!
>  >>
>  >>  thx
>  >>
>  >>  Matt Raible schrieb:
>  >>
>  >>
>  >>> What's the error you're seeing from a particular test - UserDaoTest
>  >>>
>  >>  > for example? You can use "mvn test -Dtest=UserDaoTest
>  >>  > -Dsurefire.useFile=false" to see the error in your console.
>  >>  >
>  >>  > Matt
>  >>  >
>  >>  > On 2/22/08, Kropp, Henning <[EMAIL PROTECTED]> wrote:
>  >>  >
>  >>  >> Hi List,
>  >>  >>
>  >>  >>  I am new to Appfuse and just installed a fresh Struts2 project with 
> full
>  >>  >>  source. I really would like my Users to speak languages. Therefor I
>  >>  >>  created a new model Language like:
>  >>  >>
>  >>  >>  @Entity
>  >>  >>  @Table(name="language")
>  >>  >>  public class Language extends BaseObject implements Serializable{
>  >>  >>     private Long id;
>  >>  >>     private String isoCode;
>  >>  >>     private String name;
>  >>  >>
>  >>  >>     @Id @GeneratedValue(strategy=GenerationType.AUTO)
>  >>  >>     public Long getId() {
>  >>  >>         return id;
>  >>  >>     }
>  >>  >>     @Column(name="iso_code")
>  >>  >>     public String getIsoCode() {
>  >>  >>         return isoCode;
>  >>  >>     }
>  >>  >>     @Column(name="name")
>  >>  >>     public String getName() {
>  >>  >>         return name;
>  >>  >>     }
>  >>  >>     [...]
>  >>  >>  }
>  >>  >>
>  >>  >>  After that I changed the User model to have an new ManyToMany
>  >>  >>  relationship the following:
>  >>  >>
>  >>  >>  [...]
>  >>  >>  @ManyToMany(fetch = FetchType.EAGER)
>  >>  >>     @JoinTable(
>  >>  >>             name="user_speaks_language",
>  >>  >>             joinColumns = { @JoinColumn( name="user_id") },
>  >>  >>             inverseJoinColumns = @JoinColumn( name="language_id")
>  >>  >>     )
>  >>  >>     public Set<Language> getLanguages() {
>  >>  >>         return languages;
>  >>  >>     }
>  >>  >>
>  >>  >>  [...]
>  >>  >>
>  >>  >>  I registered  Language with Hibernate in the hibernate.cfg.xml 
> <mapping
>  >>  >>  class="com.bitpitch.model.Language" /> . Had Appfuse generate me the
>  >>  >>  rest. After that all the Dao Tests are massed up.
>  >>  >>
>  >>  >>  [...]
>  >>  >>  Tests in error:
>  >>  >>   testGetRoles(com.bitpitch.dao.LookupDaoTest)
>  >>  >>   testSend(com.bitpitch.service.MailEngineTest)
>  >>  >>   testSendMessageWithAttachment(com.bitpitch.servi
>  >>  >>   testExecute(com.bitpitch.webapp.action.PasswordH
>  >>  >>   testColumnMapping(com.bitpitch.dao.hibernate.Hib
>  >>  >>   testSearch(com.bitpitch.webapp.action.UserAction
>  >>  >>   testEdit(com.bitpitch.webapp.action.UserActionTe
>  >>  >>   testSave(com.bitpitch.webapp.action.UserActionTe
>  >>  >>   testRemove(com.bitpitch.webapp.action.UserAction
>  >>  >>   testCancel(com.bitpitch.webapp.action.UserAction
>  >>  >>   testSaveConflictingUser(com.bitpitch.webapp.acti
>  >>  >>   testGetRoleInvalid(com.bitpitch.dao.RoleDaoTest)
>  >>  >>   testGetRole(com.bitpitch.dao.RoleDaoTest)
>  >>  >>   testUpdateRole(com.bitpitch.dao.RoleDaoTest)
>  >>  >>   testAddAndRemoveRole(com.bitpitch.dao.RoleDaoTes
>  >>  >>   testCRUD(com.bitpitch.dao.UniversalDaoTest)
>  >>  >>   testAddExistingUser(com.bitpitch.service.UserExi
>  >>  >>   testContextInitialized(com.bitpitch.webapp.liste
>  >>  >>   testExecute(com.bitpitch.webapp.action.SignupAct
>  >>  >>   testDisplayForm(com.bitpitch.webapp.action.Signu
>  >>  >>   testSearch(com.bitpitch.webapp.action.LanguageAc
>  >>  >>   testEdit(com.bitpitch.webapp.action.LanguageActi
>  >>  >>   testSave(com.bitpitch.webapp.action.LanguageActi
>  >>  >>   testRemove(com.bitpitch.webapp.action.LanguageAc
>  >>  >>   testGetUserInvalid(com.bitpitch.dao.UserDaoTest)
>  >>  >>   testGetUser(com.bitpitch.dao.UserDaoTest)
>  >>  >>   testGetUserPassword(com.bitpitch.dao.UserDaoTest
>  >>  >>   testUpdateUser(com.bitpitch.dao.UserDaoTest)
>  >>  >>   testAddUserRole(com.bitpitch.dao.UserDaoTest)
>  >>  >>   testAddAndRemoveUser(com.bitpitch.dao.UserDaoTes
>  >>  >>   testUserExists(com.bitpitch.dao.UserDaoTest)
>  >>  >>   testUserNotExists(com.bitpitch.dao.UserDaoTest)
>  >>  >>   testGetUser(com.bitpitch.service.UserManagerTest
>  >>  >>   testAddAndRemoveUser(com.bitpitch.service.UserMa
>  >>  >>   testSaveUser(com.bitpitch.service.UserManagerTes
>  >>  >>
>  >>  >>  Tests run: 67, Failures: 0, Errors: 35, Skipped: 0
>  >>  >>
>  >>  >>  [...]
>  >>  >>
>  >>  >>  Could someone please explain to me, what's happening here? 
> (obviously) I
>  >>  >>  consider it to be a Dao / Spring / Hibernate problem. Do I have to
>  >>  >>  register Language with the ApplicationContext?  Can't I use the
>  >>  >>  GenericDao? And if so why? Do I have to do an explicit mapping? If 
> where
>  >>  >>  do I put the mapping? There is the sql-map-config.xml. But all 
> entries
>  >>  >>  in it point to a folder that doesn't exist.
>  >>  >>
>  >>  >>  Many thanks in advanced
>  >>  >>  Henning Kropp
>  >>  >>
>  >>  >>  ---------------------------------------------------------------------
>  >>  >>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >>  >>  For additional commands, e-mail: [EMAIL PROTECTED]
>  >>  >>
>  >>  >>
>  >>  >>
>  >>  >
>  >>  > ---------------------------------------------------------------------
>  >>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >>  >
>  >>  >
>  >>
>  >>
>  >>  ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >>  For additional commands, e-mail: [EMAIL PROTECTED]
>  >>
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to