on 10-08-2005 6:43 PM
Within our current project we used a O/R mapping tool to generate our JavaBean model. For e.g.
<b>public class Person{
private String name; ...getName() ...setName(...)
}</b>
The whole model is used within our Web Dynpro project. Now it's a requirement to implement field length constraints. Normally this is no problem using ISimpleType like the following:
<b>attributeInfo = wdContext.nodePerson().getNodeInfo().getAttribute
(IPrivate...IPersonElement.NAME);
ISimpleTypeModifiable type = attributeInfo.getModifiableSimpleType();
type.setLength(60);</b>
But we've got an runtime exception that it is not allowed to modify the models datatype:
com.sap.tc.webdynpro.progmodel.context.ContextException: AttributeInfo
<b>(Basics.Person.name): must not modify the datatype of a mapped attribute</b>
at
com.sap.tc.webdynpro.progmodel.context.AttributeInfo.getModifiableSimpleType
(AttributeInfo.java:337)
The question is how could a workaround look like. Or is there nothing like that and we have to build a dictionary type tier upon our JavaBean model. Any ideas ?
thx,
s.w.
Sabine,
You may:
1. Import JavaBeans model
2. Create DDIC type with necessary constarints (string-based, max. length 60)
3. Open editor for target model class and change type of property.
See my blog /people/valery.silaev/blog/2005/06/29/apojo--almostplain-old-java-objects-as-model (section "Tweaking model classes") for details.
Valery Silaev
EPAM Systems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.