Results 1 to 8 of 8

Thread: Spring Roo App with multiple datasources

Threaded View

  1. #1
    Join Date
    May 2010
    Location
    Angolo Terme, BS, Italy
    Posts
    57

    Exclamation Spring Roo App with multiple datasources

    Hi everyone.

    My Roo application needs to access two different db.

    The main is a mysql db, setted up by Roo shell persistence command.

    The other one is a mssql db and I use it for reading the users details. I create a reference to this datasource in applicationContext. Then I've created by hand the User class in my domain package setting the datasource defined in applicationContext. Then I've created the controller and the views, so I can show for example the list of all the users in user table.

    Now, in my Job entity (stored in the main db), i need to put a reference to the User.

    Code:
    @NotNull
    @ManyToOne(targetEntity = User.class)
    @JoinColumn
    private User user;
    But when I run the project I get this error:

    Code:
    Invocation of init method failed; nested exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on domain.Job.client references an unknown entity: domain.User.
    So I put the @Entity annotation in the User class but i got this error:

    Code:
    Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: domain.User
    What I do wrong?

    Is this the best way for handling multiple datasources in Roo?

    Thank you for any reply
    Marco
    Last edited by mserioli; Jul 26th, 2010 at 06:11 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •