Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8293089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:42:45+00:00 2026-06-08T13:42:45+00:00

I have been trying for a few days now to get the composite key

  • 0

I have been trying for a few days now to get the composite key to work looking at the many example on the web, but still am missing something since it isn’t working. With the code posted below I am currently experiencing the follow error: Could not determine type for: java.util.Set, at table: USER_PROFILE, for columns: [org.hibernate.mapping.Column(userProfileDataFilter)].

If I comment out the UserProfileDataFilter from the UserProfile object everything is running smoothly with saves and deletes. I have moved the annotations from the variables to the getters with not luck. So, I am not sure what else needs to be done which is why I am here pleading for help.

Any guidance through this wicked maze of annotations is GREATLY appreciated.

USER PROFILE CLASS:

@Entity
@Table(name="USER_PROFILE")
public class UserProfile extends UserProfileAbstract implements Serializable {

private static final long serialVersionUID = CommonDefines.SERIALVERSIONUID;

public Company company; 
private Set<UserProfileDataFilter> userProfileDataFilter = new HashSet<UserProfileDataFilter>(0);

public UserProfile(){super();}
public UserProfile(String ploginName, String ppassword, Date ppasswordExprDt, String pfirstName, String plastName,
        String pemail, UUID pcompanyId, Long pstatusId, UUID pcrtdId, Date pcrtdDt, UUID pmodId, Date pmodDt){

    super(ploginName, ppassword, ppasswordExprDt, pfirstName, plastName,
            pemail, pcompanyId, pstatusId, pcrtdId, pcrtdDt, pmodId, pmodDt);
}

@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="COMPANY_ID",insertable=false,updatable=false,nullable=false)
public Company getCompany() {
    return company;
}
public void setCompany(Company company) {
    this.company = company;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.userProfile", cascade=CascadeType.ALL)
public Set<UserProfileDataFilter> getUserProfileDataFilter() {
    return userProfileDataFilter;
}
public void setUserProfileDataFilter(
        Set<UserProfileDataFilter> userProfileDataFilter) {
    this.userProfileDataFilter = userProfileDataFilter;
}

USER PROFILE DATA FILTER CLASS (COMPOSITE KEY):

@Entity
@Table(name="USER_PROFILE_DATA_FILTER")
@AssociationOverrides({
@AssociationOverride(name="pk.userProfile", joinColumns=@JoinColumn(name="USER_PROFILE_ID")),
@AssociationOverride(name="pk.dataFilter", joinColumns=@JoinColumn(name="DATA_FILTER_ID")) })
public class UserProfileDataFilter implements Serializable {

private static final long serialVersionUID = CommonDefines.SERIALVERSIONUID;
private UserProfileDataFilterPK pk = new UserProfileDataFilterPK();
private UUID crtdId;
private Date crtdDt;
private UUID modId;
private Date modDt;

@EmbeddedId
public UserProfileDataFilterPK getPk() {
    return pk;
}

public void setPk(UserProfileDataFilterPK pk) {
    this.pk = pk;
}

@Transient
public UserProfile getUserProfile() {
    return getPk().getUserProfile();
}

public void setUserProfile(UserProfile userProfile) {
    getPk().setUserProfile(userProfile);
}

@Transient
public DataFilter getDataFilter() {
    return getPk().getDataFilter();
}

public void setDataFilter(DataFilter dataFilter) {
    getPk().setDataFilter(dataFilter);
}


@Column(name="CRTD_ID", nullable=false)
public UUID getCrtdId() {
    return crtdId;
}

public void setCrtdId(UUID crtdId) {
    this.crtdId = crtdId;
}

@Column(name="CRTD_DT", nullable=false)
@Temporal(TemporalType.TIMESTAMP)
public Date getCrtdDt() {
    return crtdDt;
}

public void setCrtdDt(Date crtdDt) {
    this.crtdDt = crtdDt;
}

@Column(name="MOD_ID", nullable=false)
public UUID getModId() {
    return modId;
}

public void setModId(UUID modId) {
    this.modId = modId;
}

@Column(name="MOD_DT", nullable=false)
@Temporal(TemporalType.TIMESTAMP)
public Date getModDt() {
    return modDt;
}

public void setModDt(Date modDt) {
    this.modDt = modDt;
}
}

USER PROFILE DATA FILTER PK (Class used to define the key)

@Embeddable
public class UserProfileDataFilterPK implements Serializable {


private static final long serialVersionUID = CommonDefines.SERIALVERSIONUID;
private UserProfile userProfile;
private DataFilter  dataFilter;

@ManyToOne
public UserProfile getUserProfile() {
    return userProfile;
}
public void setUserProfile(UserProfile userProfile) {
    this.userProfile = userProfile;
}

@ManyToOne
public DataFilter getDataFilter() {
    return dataFilter;
}
public void setDataFilter(DataFilter dataFilter) {
    this.dataFilter = dataFilter;
}

public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

UserProfileDataFilterPK that = (UserProfileDataFilterPK) o;

if (userProfile != null ? !userProfile.equals(that.userProfile) : that.userProfile != null) return false;
if (dataFilter != null ? !dataFilter.equals(that.dataFilter) : that.dataFilter != null)
    return false;

return true;
}

public int hashCode() {
    int result;
    result = (userProfile != null ? userProfile.hashCode() : 0);
    result = 31 * result + (dataFilter != null ? dataFilter.hashCode() : 0);
    return result;
}
}

DATA FILTER CLASS:

@Entity
@Table(name="DATA_FILTER")
public class DataFilter extends DataFilterAbstract {

private static final long serialVersionUID = CommonDefines.SERIALVERSIONUID;

@Transient
protected boolean selected;

@OneToMany(mappedBy="dataFilterId")
public Set<DataFilterDetail> dataFilterDetails;

public DataFilter(){super();}
public DataFilter(boolean pselected, String pname, String pdescription, boolean pActive, UUID pcrtdId, Date pcrtdDt, UUID pmodId, Date pmodDt){
    super(pname,pdescription,pActive, pcrtdId, pcrtdDt, pmodId, pmodDt);
    selected = pselected;
}

public boolean isSelected() {
    return selected;
}
public void setSelected(boolean selected) {
    this.selected = selected;
}
public Set<DataFilterDetail> getDataFilterDetails() {
    return dataFilterDetails;
}
public void setDataFilterDetails(Set<DataFilterDetail> dataFilterDetails) {
    this.dataFilterDetails = dataFilterDetails;
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T13:42:47+00:00Added an answer on June 8, 2026 at 1:42 pm

    Sometimes you put annotations on fields, and sometimes on accessores (getters). Always put them on the same place in a given hierarchy of classes.

    IIRC, Hibernate only considers annotations that are placed at the same location as the @Id (or @EmbeddedId) annotation. So if @Id is on a getter, and you have a @OneToMany on a field, the @OneToMany annotation will be ignored.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a few days now, I have been trying to get my Java project
For a few days now I have been trying to get an ASMX webservice
I have been searching through here and google for a few days now, trying
I have been trying to do this for a few days now using AVFoundation
I've been trying to get this working for a few days now.. flabbergasted. I'm
For a few days, I have been trying to get the username to save
I have been trying to figure this out for a few days now and
I've been trying for a few days now to get Google App Engine to
I have been trying to figure out for a few days now why my
For the past few days I have been trying to play any sound over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.