[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2843) org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of natural Key component

ross bu (JIRA) noreply at atlassian.com
Tue Mar 22 11:31:09 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=41825#action_41825 ] 

ross bu commented on HHH-2843:
------------------------------

We are building a CMS system for our customer using Hibernate 3.2.3 GA as ORM framework, which was fine until we came across this similar issue described in https://forum.hibernate.org/viewtopic.php?t=979408  we couldn't figure out what caused this issue since looks like the getting method are throwing IllegalArgumentException when hibernate is trying to call method by reflect the methods like adminAction , all codes like below


@Entity
@Table(name = "cmsadmin_action_displayname")
@Cache(region = "cmsadmin", usage = CacheConcurrencyStrategy.READ_ONLY)
public class CMSAdminArticleActionDisplayName extends SEPersistent<CMSAdminArticleActionDisplayName.CmsAdminArticleActionDisplayNamePK> {

	private CmsAdminArticleActionDisplayNamePK id;
	private String actionDisplayName;
	private String createdBy;

	/**
	 * @return the id
	 */
	@Id
	public CmsAdminArticleActionDisplayNamePK getId() {
		return id;
	}



	/**
	 * @param id the id to set
	 */
	public void setId(CmsAdminArticleActionDisplayNamePK id) {
		this.id = id;
	}




	@Embeddable
	 public static final class CmsAdminArticleActionDisplayNamePK extends BaseObject {

		/**
	      * Serial version.
	      */
	     private static final long serialVersionUID = 1L;

		 private CmsAdminAction adminAction;
		 private Language language;

		 public CmsAdminArticleActionDisplayNamePK(){

		 }

		 public  CmsAdminArticleActionDisplayNamePK(CmsAdminAction cmsAdminAction, Language language){
			 this.adminAction = cmsAdminAction;
			 this.language = language;
		 }

		 /**
			 * @return the adminAction
			 */

		 @ManyToOne
		    @JoinColumn(name="actionID", referencedColumnName="actionID",insertable=false, updatable=false)
			public CmsAdminAction getAdminAction() {
				return adminAction;
			}
			/**
			 * @param adminAction the adminAction to set
			 */
			public void setAdminAction(CmsAdminAction adminAction) {
				this.adminAction = adminAction;
			}



		/**
		 * @return the language
		 */
		 @ManyToOne
		 @JoinColumn(name="languageID", referencedColumnName="languageID",insertable=false, updatable=false)
		public Language getLanguage() {
			return language;
		}
		/**
		 * @param language2 the language to set
		 */
		public void setLanguage(Language language) {
			this.language = language;
		}
            }
.......
}

CmsAdminAction is like below
@Entity
@Table(name = "cmsadmin_action")
@Cache(region = "cmsadmin", usage = CacheConcurrencyStrategy.READ_ONLY)
public class CmsAdminAction extends SEPersistent<Integer>{
	private  Integer id;
	private String actionName;
	private Set<CMSAdminArticleActionDisplayName> displayNames = new HashSet<CMSAdminArticleActionDisplayName>();
	private Collection<CmsAdminArticleStatus> statuses ;
	private Collection<CMSAdminTemplateStatus> templateStatuses ;
	private Collection<CMSAdminOfferStatus> offerStatuses ;
	private String createdBy;


	@Id
	@Column(name = "actionID")
	public Integer getId() {
		return id;
	}


	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "actionName")
	public String getActionName() {
		return actionName;
	}


	public void setActionName(String actionName) {
		this.actionName = actionName;
	}


	@Column(name = "createdBy")
	public String getCreatedBy() {
		return createdBy;
	}


	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}


	@OneToMany(mappedBy = "id.adminAction")
	public Set<CMSAdminArticleActionDisplayName> getDisplayNames() {
		return displayNames;
	}


	public void setDisplayNames(Set<CMSAdminArticleActionDisplayName> displayNames) {
		this.displayNames = displayNames;
	}

	@ManyToMany(mappedBy = "cmsActionNames")
	public Collection<CmsAdminArticleStatus> getStatuses() {
		return statuses;
	}

.....
}
	

> org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of natural Key component
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-2843
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2843
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.3
>         Environment: Linux
>            Reporter: Charles Canning
>
> The full description is here in the forums: http://forum.hibernate.org/viewtopic.php?t=979408
> I will provide more details if I can. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list