-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Several Any Annotation in a Entity
PostPosted: Fri Aug 13, 2010 4:48 am 
Newbie

Joined: Fri Aug 13, 2010 4:43 am
Posts: 3
Hello,

I have one problem with the Any annotation. I have more than one properties in my mapping that depends on the same column/property (in this case TYPE_SETTING).

@Any(metaColumn = @Column(name="TYPE_SETTING",unique=false,updatable=false,insertable=false))
@AnyMetaDef(idType = "int", metaType = "string", metaValues = {
@MetaValue(targetEntity = eu.sanco.rasff.model.setting.Company.class, value = TypeSettingEnum.COMPANY_STRING) ,
@MetaValue(targetEntity = eu.sanco.rasff.model.setting.Laboratory.class, value = TypeSettingEnum.LABORATORY_STRING)
)
}
)
@JoinColumn(name="CURRENT_SETTING",nullable=false,updatable=true,insertable=true)
@Cascade(value = { CascadeType.ALL })
private AbstractSetting current;


@Column(name= "TYPE_SETTING", columnDefinition="INTEGER", nullable = false,updatable=false,insertable=false,unique=false)
@Type(
type = "eu.sanco.rasff.model.enums.hibernate.TypeSettingEnumUserType"
)
private TypeSettingEnum typeSetting;


@Any(metaColumn = @Column(name="TYPE_SETTING",unique=false,updatable=false,insertable=false))
@AnyMetaDef(idType = "int",
metaType = "string",
metaValues = {
@MetaValue(targetEntity = eu.sanco.rasff.model.version.setting.CompanyHistory.class, value = TypeSettingEnum.COMPANY_STRING) ,
@MetaValue(targetEntity = eu.sanco.rasff.model.version.setting.LaboratoryHistory.class, value = TypeSettingEnum.LABORATORY_STRING))
}
)
@JoinColumn(name="PREVIOUS",updatable=true,insertable=true,nullable=true)
private IHistoricable previous;



The problem is that I have 2 properties that depending the value of TYPE_SETTING they will be mapped to the result of the AnyMetaDef. I know one solution, but it is not very elegant: to create other column TYPE_SETTING_2 and refer to it.

Please let me know with any update.

Thanks


Top
 Profile  
 
 Post subject: Re: Several Any Annotation in a Entity
PostPosted: Mon Aug 16, 2010 3:05 am 
Newbie

Joined: Fri Aug 13, 2010 4:43 am
Posts: 3
Any update?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.