I have one JPAController Class that having create method to save record in Parent and Detail Table. The Primary key is of BigDecimal type with 8 scale and 15 precision in both the tables. Now my Question is When i call the create method i get the error in public T getReference(Class entity Class, Object primary Key) as BigDecimal with 3 scale and 5 Precision,if take 42.20112012 as reference key then i got error as,
Caused by: javax.persistence.EntityNotFoundException: Could not find entitiy for id: 42.201
My create method in JPAController Class is as below , in which i want to insert record in RuleApplGroupMst(Parent Table) and RuleGroupRelation(Detail Table) Tables,
Collection<RuleGroupRelation> attachedRuleGroupRelationCollection = new ArrayList<RuleGroupRelation>();
for (RuleGroupRelation RuleGroupRelationCollectionRuleGroupRelationToAttach : RuleApplGroupMst.getRuleGroupRelationCollection()) {
RuleGroupRelationCollectionRuleGroupRelationToAttach = em.getReference(RuleGroupRelationCollectionRuleGroupRelationToAttach.getClass(),RuleGroupRelationCollectionRuleGroupRelationToAttach.getRgrSrgKey());
attachedRuleGroupRelationCollection.add(RuleGroupRelationCollectionRuleGroupRelationToAttach);
}
Thanks for any help…..
I got the answer,
In My Case, i have created the user defined method in JPAController Class as below,
and then declare OneToMany Relationship in Entity Bean as,
and then i call create_custom method by managed bean.
It works with all type(including BigDecimal) of Primary/Reference Key.