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

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

    enztp

      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 =
          epbernard

           

          @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