1 Reply Latest reply on Jul 1, 2005 7:18 AM by Emmanuel Bernard

    2 @OneToOne(mappedBy = "xxx") in the same method

    Enzo Poeta Newbie

      Hi !!!

      I have two tables(usuario,area) pointing a foreign key that are located on another table (rkos90)....
      Can i represent the reverse relation mapping of this two tables in rkos90 ?

      something like this :

      // Code of rkos90 entity
       @OneToOne(mappedBy = "usuario")
       @OneToOne(mappedBy = "area")
       @Id(generate = GeneratorType.NONE)
       @Column(updatable = true, name = "cd_ccust", nullable = false, length = 5)
       public String getCodigoCentroCusto()
       {
       return codigoCCusto;
       }
      
      


      how can i obtain this same result ?

        • 1. Re: 2 @OneToOne(mappedBy =
          Emmanuel Bernard Master

           

          @OneToOne(mappedBy = "usuario")
           @OneToOne(mappedBy = "area")
           @Id(generate = GeneratorType.NONE)
           @Column(updatable = true, name = "cd_ccust", nullable = false, length = 5)
           public String getCodigoCentroCusto()

          This code should not work. you can't have a @OneToOne on a property of type string