Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

JRat with Hibernate and Tomcat

2009-01-09
2013-04-25
  • Hi, getting a problem trying to use JRat with my Tomcat app. Not sure if this or the Hibernate list is the best place, will try here first.

    The error

    5227 [main] INFO org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: com.gtwm.pb.model.manageSchema.TableDefn.reportsCollection_$jrat -> BaseReportDefn

    Fri 2009/01/09 16:40:17.141|Error|HibernateUtil|Initial SessionFactory creation failed: org.hibernate.AnnotationException: Referenced property not a (One|Many)ToOne: com.gtwm.pb.model.manageSchema.BaseReportDefn.reportSummary in mappedBy of com.gtwm.pb.model.manageSchema.ReportSummaryDefn.report_$jrat

    appears when starting Tomcat. It looks like the Hibernate mapping fails because of something to do with the _$jrat appended.

    We use annotations for Hibernate, in this case there's a method in com.gtwm.pb.model.manageSchema.BaseReportDefn

        @OneToOne(targetEntity = ReportSummaryDefn.class, cascade = CascadeType.ALL)
        public ReportSummaryInfo getReportSummary() {
            return this.reportSummary;
        }

    and a corresponding method in ReportSummaryDefn

        @OneToOne(mappedBy = "reportSummary", targetEntity = BaseReportDefn.class)
        public BaseReportInfo getReport() {
            return this.report;
        }

    Any ideas?

    Regards
    Oliver Kohll

     
    • Steve Ulrich
      Steve Ulrich
      2009-01-27

      Similar problem here with Glassfish and Hibernate:
      org.hibernate.MappingException: Foreign key (...) must have same number of columns as the referenced primary key (...)

      This only happens when JRat is active