<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
<table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
<h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
<!-- To have a header image/logo replace the name below with your img tag -->
<!-- Email clients will render the images when the message is read so any image -->
<!-- must be made available on a public server, so that all recipients can load the image. -->
<a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Need help getting Spring, Hibernate project working again with Hibernate reverse engineering creates classes
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/techsjs2012">techsjs2012</a> in <i>JBoss Tools</i> - <a href="https://community.jboss.org/message/796379#796379">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>I had my project working for a few months now but my firm is moving to new model classes that are Need help getting Spring, Hibernate project working again with Hibernate reverse engineering created.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Below is my DAO code that worked in the past </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>@Transactional(readOnly=true, propagation=Propagation.REQUIRED)</p><p>    public MemberInquiryLookup getMemberInquiryLookup(String requester) {</p><p>        </p><p>        </p><p>        log.debug("Looking for data for:" + requester);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>        MemberInquiryLookup dr = (MemberInquiryLookup)</p><p>                sessionFactory.getCurrentSession()</p><p>                .get(MemberInquiryLookup.class, requester);</p><p>        if (dr == null) {</p><p>            log.debug("NO DATA for :" + requester + " was found.");</p><p>            </p><p>            dr = new MemberInquiryLookup();</p><p>        }</p><p>        return dr;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>and here is my old model class:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Entity</p><p>    @Table(name = " member_inquiry_lookup")</p><p>    public class MemberInquiryInformation {</p><p>    </p><p>        @Id</p><p>        @Column(name = "email")</p><p>        private String email;</p><p>    </p><p>        @Column(name = "first_name")</p><p>        private String First_Name;</p><p>    </p><p>        @Column(name = "last_name")</p><p>        private String Last_Name;</p><p>    </p><p>        public String getFirst_Name() {</p><p>            return First_Name;</p><p>        }</p><p>    </p><p>        public void setFirst_Name(String first_Name) {</p><p>            First_Name = first_Name;</p><p>        }</p><p>    </p><p>        public String getLast_Name() {</p><p>            return Last_Name;</p><p>        }</p><p>    </p><p>        public void setLast_Name(String last_Name) {</p><p>            Last_Name = last_Name;</p><p>        }</p><p>    </p><p>        @Column(name = "member_id")</p><p>        private String member_id;</p><p>    </p><p>        @Column(name = "school_id")</p><p>        private String school_id;</p><p>    </p><p>        @Column(name = "title_id")</p><p>        private String title_id;</p><p>    </p><p>        @Column(name = "title_description")</p><p>        private String title_description;</p><p>    </p><p>        @Column(name = "school_search_name")</p><p>        private String school_search_name;</p><p>    </p><p>        @Column(name = "borough_description")</p><p>        private String borough_description;</p><p>    </p><p>        @Column(name = "district")</p><p>        private String district;</p><p>    </p><p>        @Column(name = "phone")</p><p>        private String phone;</p><p>    </p><p>        @Column(name = "file_number")</p><p>        private String file_number;</p><p>    </p><p>        @Column(name = "member_group")</p><p>        private String member_group;</p><p>    </p><p>        public String getEmail() {</p><p>            return email;</p><p>        }</p><p>    </p><p>        public void setEmail(String email) {</p><p>            this.email = email;</p><p>        }</p><p>    </p><p>        public String getMember_id() {</p><p>            return member_id;</p><p>        }</p><p>    </p><p>        public void setMember_id(String member_id) {</p><p>            this.member_id = member_id;</p><p>        }</p><p>    </p><p>        public String getSchool_id() {</p><p>            return school_id;</p><p>        }</p><p>    </p><p>        public void setSchool_id(String school_id) {</p><p>            this.school_id = school_id;</p><p>        }</p><p>    </p><p>        public String getTitle_id() {</p><p>            return title_id;</p><p>        }</p><p>    </p><p>        public void setTitle_id(String title_id) {</p><p>            this.title_id = title_id;</p><p>        }</p><p>    </p><p>        public String getTitle_description() {</p><p>            return title_description;</p><p>        }</p><p>    </p><p>        public void setTitle_description(String title_description) {</p><p>            this.title_description = title_description;</p><p>        }</p><p>    </p><p>        public String getSchool_search_name() {</p><p>            return school_search_name;</p><p>        }</p><p>    </p><p>        public void setSchool_search_name(String school_search_name) {</p><p>            this.school_search_name = school_search_name;</p><p>        }</p><p>    </p><p>        public String getBorough_description() {</p><p>            return borough_description;</p><p>        }</p><p>    </p><p>        public void setBorough_description(String borough_description) {</p><p>            this.borough_description = borough_description;</p><p>        }</p><p>    </p><p>        public String getDistrict() {</p><p>            return district;</p><p>        }</p><p>    </p><p>        public void setDistrict(String district) {</p><p>            this.district = district;</p><p>        }</p><p>    </p><p>        public String getPhone() {</p><p>            return phone;</p><p>        }</p><p>    </p><p>        public void setPhone(String phone) {</p><p>            this.phone = phone;</p><p>        }</p><p>    </p><p>        public String getFile_number() {</p><p>            return file_number;</p><p>        }</p><p>    </p><p>        public void setFile_number(String file_number) {</p><p>            this.file_number = file_number;</p><p>        }</p><p>    </p><p>        public String getMember_group() {</p><p>            return member_group;</p><p>        }</p><p>    </p><p>        /**</p><p>         * @return</p><p>         */</p><p>        public String getQueue() {</p><p>            if (getMember_group().equalsIgnoreCase("RT"))</p><p>                return "Retiree";</p><p>    </p><p>            return getBorough_description();</p><p>            </p><p>            /*if (getBorough_description().equalsIgnoreCase("BRONX"))</p><p>                return Constants.BRONX;</p><p>    </p><p>            if (getBorough_description().equalsIgnoreCase("BROOKLYN"))</p><p>                return Constants.BROOKLYN;</p><p>    </p><p>            if (getBorough_description().equalsIgnoreCase("QUEENS"))</p><p>                return Constants.QUEENS;</p><p>    </p><p>            if (getBorough_description().equalsIgnoreCase("MANHATTAN"))</p><p>                return Constants.MANATTAN;</p><p>    </p><p>            if (getBorough_description().equalsIgnoreCase("STATEN ISLAND"))</p><p>                return Constants.STATENISLAND;*/</p><p>    </p><p>        }</p><p>    </p><p>        public void setMember_group(String member_group) {</p><p>            this.member_group = member_group;</p><p>        }</p><p>    </p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>but Hibernate reverse engineering creates the following TWO classed for the same table:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Entity</p><p>    @Table(name = "member_inquiry_lookup")</p><p>    public class MemberInquiryLookup implements java.io.Serializable {</p><p>    </p><p>        private MemberInquiryLookupId id;</p><p>    </p><p>        public MemberInquiryLookup() {</p><p>        }</p><p>    </p><p>        public MemberInquiryLookup(MemberInquiryLookupId id) {</p><p>            this.id = id;</p><p>        }</p><p>    </p><p>        @EmbeddedId</p><p>        @AttributeOverrides({</p><p>                @AttributeOverride(name = "email", column = @Column(name = "email", nullable = false)),</p><p>                @AttributeOverride(name = "memberId", column = @Column(name = "member_id")),</p><p>                @AttributeOverride(name = "firstName", column = @Column(name = "first_name", length = 15)),</p><p>                @AttributeOverride(name = "lastName", column = @Column(name = "last_name", length = 25)),</p><p>                @AttributeOverride(name = "schoolId", column = @Column(name = "school_id", length = 10)),</p><p>                @AttributeOverride(name = "titleId", column = @Column(name = "title_id", length = 5)),</p><p>                @AttributeOverride(name = "titleDescription", column = @Column(name = "title_description", length = 60)),</p><p>                @AttributeOverride(name = "schoolSearchName", column = @Column(name = "school_search_name")),</p><p>                @AttributeOverride(name = "boroughDescription", column = @Column(name = "borough_description")),</p><p>                @AttributeOverride(name = "district", column = @Column(name = "district")),</p><p>                @AttributeOverride(name = "phone", column = @Column(name = "phone", length = 16)),</p><p>                @AttributeOverride(name = "fileNumber", column = @Column(name = "file_number", length = 9)),</p><p>                @AttributeOverride(name = "memberGroup", column = @Column(name = "member_group", length = 4)) })</p><p>        public MemberInquiryLookupId getId() {</p><p>            return this.id;</p><p>        }</p><p>    </p><p>        public void setId(MemberInquiryLookupId id) {</p><p>            this.id = id;</p><p>        }</p><p>    </p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>and </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Embeddable</p><p>    public class MemberInquiryLookupId implements java.io.Serializable {</p><p>    </p><p>        private String email;</p><p>        private Integer memberId;</p><p>        private String firstName;</p><p>        private String lastName;</p><p>        private String schoolId;</p><p>        private String titleId;</p><p>        private String titleDescription;</p><p>        private String schoolSearchName;</p><p>        private String boroughDescription;</p><p>        private String district;</p><p>        private String phone;</p><p>        private String fileNumber;</p><p>        private String memberGroup;</p><p>    </p><p>        public MemberInquiryLookupId() {</p><p>        }</p><p>    </p><p>        public MemberInquiryLookupId(String email) {</p><p>            this.email = email;</p><p>        }</p><p>    </p><p>        public MemberInquiryLookupId(String email, Integer memberId,</p><p>                String firstName, String lastName, String schoolId, String titleId,</p><p>                String titleDescription, String schoolSearchName,</p><p>                String boroughDescription, String district, String phone,</p><p>                String fileNumber, String memberGroup) {</p><p>            this.email = email;</p><p>            this.memberId = memberId;</p><p>            this.firstName = firstName;</p><p>            this.lastName = lastName;</p><p>            this.schoolId = schoolId;</p><p>            this.titleId = titleId;</p><p>            this.titleDescription = titleDescription;</p><p>            this.schoolSearchName = schoolSearchName;</p><p>            this.boroughDescription = boroughDescription;</p><p>            this.district = district;</p><p>            this.phone = phone;</p><p>            this.fileNumber = fileNumber;</p><p>            this.memberGroup = memberGroup;</p><p>        }</p><p>    </p><p>        @Column(name = "email", nullable = false)</p><p>        public String getEmail() {</p><p>            return this.email;</p><p>        }</p><p>    </p><p>        public void setEmail(String email) {</p><p>            this.email = email;</p><p>        }</p><p>    </p><p>        @Column(name = "member_id")</p><p>        public Integer getMemberId() {</p><p>            return this.memberId;</p><p>        }</p><p>    </p><p>        public void setMemberId(Integer memberId) {</p><p>            this.memberId = memberId;</p><p>        }</p><p>    </p><p>        @Column(name = "first_name", length = 15)</p><p>        public String getFirstName() {</p><p>            return this.firstName;</p><p>        }</p><p>    </p><p>        public void setFirstName(String firstName) {</p><p>            this.firstName = firstName;</p><p>        }</p><p>    </p><p>        @Column(name = "last_name", length = 25)</p><p>        public String getLastName() {</p><p>            return this.lastName;</p><p>        }</p><p>    </p><p>        public void setLastName(String lastName) {</p><p>            this.lastName = lastName;</p><p>        }</p><p>    </p><p>        @Column(name = "school_id", length = 10)</p><p>        public String getSchoolId() {</p><p>            return this.schoolId;</p><p>        }</p><p>    </p><p>        public void setSchoolId(String schoolId) {</p><p>            this.schoolId = schoolId;</p><p>        }</p><p>    </p><p>        @Column(name = "title_id", length = 5)</p><p>        public String getTitleId() {</p><p>            return this.titleId;</p><p>        }</p><p>    </p><p>        public void setTitleId(String titleId) {</p><p>            this.titleId = titleId;</p><p>        }</p><p>    </p><p>        @Column(name = "title_description", length = 60)</p><p>        public String getTitleDescription() {</p><p>            return this.titleDescription;</p><p>        }</p><p>    </p><p>        public void setTitleDescription(String titleDescription) {</p><p>            this.titleDescription = titleDescription;</p><p>        }</p><p>    </p><p>        @Column(name = "school_search_name")</p><p>        public String getSchoolSearchName() {</p><p>            return this.schoolSearchName;</p><p>        }</p><p>    </p><p>        public void setSchoolSearchName(String schoolSearchName) {</p><p>            this.schoolSearchName = schoolSearchName;</p><p>        }</p><p>    </p><p>        @Column(name = "borough_description")</p><p>        public String getBoroughDescription() {</p><p>            return this.boroughDescription;</p><p>        }</p><p>    </p><p>        public void setBoroughDescription(String boroughDescription) {</p><p>            this.boroughDescription = boroughDescription;</p><p>        }</p><p>    </p><p>        @Column(name = "district")</p><p>        public String getDistrict() {</p><p>            return this.district;</p><p>        }</p><p>    </p><p>        public void setDistrict(String district) {</p><p>            this.district = district;</p><p>        }</p><p>    </p><p>        @Column(name = "phone", length = 16)</p><p>        public String getPhone() {</p><p>            return this.phone;</p><p>        }</p><p>    </p><p>        public void setPhone(String phone) {</p><p>            this.phone = phone;</p><p>        }</p><p>    </p><p>        @Column(name = "file_number", length = 9)</p><p>        public String getFileNumber() {</p><p>            return this.fileNumber;</p><p>        }</p><p>    </p><p>        public void setFileNumber(String fileNumber) {</p><p>            this.fileNumber = fileNumber;</p><p>        }</p><p>    </p><p>        @Column(name = "member_group", length = 4)</p><p>        public String getMemberGroup() {</p><p>            return this.memberGroup;</p><p>        }</p><p>    </p><p>        public void setMemberGroup(String memberGroup) {</p><p>            this.memberGroup = memberGroup;</p><p>        }</p><p>    </p><p>        public boolean equals(Object other) {</p><p>            if ((this == other))</p><p>                return true;</p><p>            if ((other == null))</p><p>                return false;</p><p>            if (!(other instanceof MemberInquiryLookupId))</p><p>                return false;</p><p>            MemberInquiryLookupId castOther = (MemberInquiryLookupId) other;</p><p>    </p><p>            return ((this.getEmail() == castOther.getEmail()) || (this.getEmail() != null</p><p>                    && castOther.getEmail() != null && this.getEmail().equals(</p><p>                    castOther.getEmail())))</p><p>                    && ((this.getMemberId() == castOther.getMemberId()) || (this</p><p>                            .getMemberId() != null</p><p>                            && castOther.getMemberId() != null && this</p><p>                            .getMemberId().equals(castOther.getMemberId())))</p><p>                    && ((this.getFirstName() == castOther.getFirstName()) || (this</p><p>                            .getFirstName() != null</p><p>                            && castOther.getFirstName() != null && this</p><p>                            .getFirstName().equals(castOther.getFirstName())))</p><p>                    && ((this.getLastName() == castOther.getLastName()) || (this</p><p>                            .getLastName() != null</p><p>                            && castOther.getLastName() != null && this</p><p>                            .getLastName().equals(castOther.getLastName())))</p><p>                    && ((this.getSchoolId() == castOther.getSchoolId()) || (this</p><p>                            .getSchoolId() != null</p><p>                            && castOther.getSchoolId() != null && this</p><p>                            .getSchoolId().equals(castOther.getSchoolId())))</p><p>                    && ((this.getTitleId() == castOther.getTitleId()) || (this</p><p>                            .getTitleId() != null && castOther.getTitleId() != null && this</p><p>                            .getTitleId().equals(castOther.getTitleId())))</p><p>                    && ((this.getTitleDescription() == castOther</p><p>                            .getTitleDescription()) || (this.getTitleDescription() != null</p><p>                            && castOther.getTitleDescription() != null && this</p><p>                            .getTitleDescription().equals(</p><p>                                    castOther.getTitleDescription())))</p><p>                    && ((this.getSchoolSearchName() == castOther</p><p>                            .getSchoolSearchName()) || (this.getSchoolSearchName() != null</p><p>                            && castOther.getSchoolSearchName() != null && this</p><p>                            .getSchoolSearchName().equals(</p><p>                                    castOther.getSchoolSearchName())))</p><p>                    && ((this.getBoroughDescription() == castOther</p><p>                            .getBoroughDescription()) || (this</p><p>                            .getBoroughDescription() != null</p><p>                            && castOther.getBoroughDescription() != null && this</p><p>                            .getBoroughDescription().equals(</p><p>                                    castOther.getBoroughDescription())))</p><p>                    && ((this.getDistrict() == castOther.getDistrict()) || (this</p><p>                            .getDistrict() != null</p><p>                            && castOther.getDistrict() != null && this</p><p>                            .getDistrict().equals(castOther.getDistrict())))</p><p>                    && ((this.getPhone() == castOther.getPhone()) || (this</p><p>                            .getPhone() != null && castOther.getPhone() != null && this</p><p>                            .getPhone().equals(castOther.getPhone())))</p><p>                    && ((this.getFileNumber() == castOther.getFileNumber()) || (this</p><p>                            .getFileNumber() != null</p><p>                            && castOther.getFileNumber() != null && this</p><p>                            .getFileNumber().equals(castOther.getFileNumber())))</p><p>                    && ((this.getMemberGroup() == castOther.getMemberGroup()) || (this</p><p>                            .getMemberGroup() != null</p><p>                            && castOther.getMemberGroup() != null && this</p><p>                            .getMemberGroup().equals(castOther.getMemberGroup())));</p><p>        }</p><p>    </p><p>        public int hashCode() {</p><p>            int result = 17;</p><p>    </p><p>            result = 37 * result</p><p>                    + (getEmail() == null ? 0 : this.getEmail().hashCode());</p><p>            result = 37 * result</p><p>                    + (getMemberId() == null ? 0 : this.getMemberId().hashCode());</p><p>            result = 37 * result</p><p>                    + (getFirstName() == null ? 0 : this.getFirstName().hashCode());</p><p>            result = 37 * result</p><p>                    + (getLastName() == null ? 0 : this.getLastName().hashCode());</p><p>            result = 37 * result</p><p>                    + (getSchoolId() == null ? 0 : this.getSchoolId().hashCode());</p><p>            result = 37 * result</p><p>                    + (getTitleId() == null ? 0 : this.getTitleId().hashCode());</p><p>            result = 37</p><p>                    * result</p><p>                    + (getTitleDescription() == null ? 0 : this</p><p>                            .getTitleDescription().hashCode());</p><p>            result = 37</p><p>                    * result</p><p>                    + (getSchoolSearchName() == null ? 0 : this</p><p>                            .getSchoolSearchName().hashCode());</p><p>            result = 37</p><p>                    * result</p><p>                    + (getBoroughDescription() == null ? 0 : this</p><p>                            .getBoroughDescription().hashCode());</p><p>            result = 37 * result</p><p>                    + (getDistrict() == null ? 0 : this.getDistrict().hashCode());</p><p>            result = 37 * result</p><p>                    + (getPhone() == null ? 0 : this.getPhone().hashCode());</p><p>            result = 37</p><p>                    * result</p><p>                    + (getFileNumber() == null ? 0 : this.getFileNumber()</p><p>                            .hashCode());</p><p>            result = 37</p><p>                    * result</p><p>                    + (getMemberGroup() == null ? 0 : this.getMemberGroup()</p><p>                            .hashCode());</p><p>            return result;</p><p>        }</p><p>    </p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>so now I do a mvn package and I am getting the following error:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    Tests in error: </p><p>      testgetMemeberRequestInformation(org.uftwf.memberinquiry.test.TestApp): Provided id of the wrong type for class org.uftwf.model.MemberInquiryLookup. Expected: class org.uftwf.model.MemberInquiryLookupId, got class java.lang.String</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/796379#796379">going to Community</a></p>
<p style="margin: 0;">Start a new discussion in JBoss Tools at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>