|
From: Stephane B. <ste...@be...> - 2004-07-13 13:06:28
|
Tomas Gustavsson wrote:
>
> I see the point in AccessRulesdataBean. When the PrimearyKey class is
> a subset if the data fields the primary key in the database is also a
> compound primary key as in HARDTOKENPROPERTYDATA for example (which is
> godo I think).
> I don't quite get the point for AdminGroupDataBean though. The primary
> key is just a field. Perhaps it qould be better to have is as a
> compound key (adminGroupName, cAId)?
It is because when generating the compound key you cannot specify the
order of the fields, it is better to use the setter to avoid problems
where args would be mixed.
I refactored this into a createAdminEntityPK (see below)
AdminEntityDataLocal data = createAdminEntity(adminentity);
AdminEntityPK datapk =
createAdminEntityPK(getAdminGroupName(), getCAId(),
adminentity.getMatchWith(), adminentity.getMatchType(),
adminentity.getMatchValue());
And I'm not sure we need to create the primary key, it should be enough
to do a getPrimaryKey on the entity. (To be verified)
>
> Philip would be best to determine if (adminGroupName, cAId) is a good
> primary key. Perhaps not since it is a random number today...It's not
> completely unusual to have a primary key nopt related to the data though.
You're absolutelty right, but it is unrelated here. The current
ejbCreate implementation of AccessRulesDataBean is:
AccessRulesPK pk = new AccessRulesPK(admingroupname, caid,
accessrule);
setPK(pk.hashCode());
setAccessRule(accessrule.getAccessRule());
setRule(accessrule.getRule());
setIsRecursive(accessrule.isRecursive());
And this is totally incorrect based on the specifications. Admingroup,
caid and accessrule need to be persistent fields to be part of a primary
key.
And the one I did is:
setAdminGroupName(admingroupname);
setCaId(caid);
setAccessRuleObject(accessrule);
> Philip is away working abroad for a few weeks unforturnately...
>
> When changing database tables, please take a minute to consider
> upgrade scripts (located in ejbca/src/upgrade).
Of course. If possible...
|