on 03-24-2015 8:03 AM
Does anyone know how to extend some new attributes based on OOB OMS data model ? For example, the OOB "Inventory" data model in OMS. We would like to rename the "warehouse" to "Slave id", introduce additional column "Master Id". Thanks in advance.
Hi,
Mixins were introduced in Hybris-5.3.
But you should be also able to use the extends syntax. The disadvantage of it is that Existing parts of oms Do not know of your new type. But the underlying persistenceManager does and you can query as you described assuming that DummyOrderData is your extending ManagedObject.
Matthias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But I tried to use mixins. But no data file is getting generated with the new attribute. I need below line in oms-ext-domain.xml :
<managedobject code="MyItemLocationData" extends="ItemLocationData" >
<attributes>
<attribute name="myAttribute" type="String">
<description>This is a dummy attribute.</description>
<modifiers unique="false" mandatory="false" final="true" indexed="true" />
</attribute>
</attributes>
</managedobject>
What could be the reason?
when we are using extends that time the MO(MyItemLocationData) is generated but when using the mixin ,no code is getting generated.The following is the entry in oms-ext-domain.xml.
<managedobject code="ItemLocationData" mixin="true">
<attributes>
<attribute name="priority" type="String" />
</attributes>
</managedobject>
No ItemLocationData.java file is generated in oms-ext-service project after doing mvn install.
No build error. You can check below link. Somebody else also got the same error. Check below link : https://answers.sap.com/questions/12752490/how-we-can-extend-managed-object-orderdata.html
So, Is it a version issue or I am missing something. i tried in different system buy without any luck.
Hi ,
In general I would not recommend to rename or delete anything in the data model as this could potentially lead to incompatibility with any existing usage. To introduce an additional attribute in the inventory data model just add a domain file defining a mixin managed object with the additional attribute. This additional attribute will be collected by the code generation and end up in an enhanced data model.
see: https://wiki.hybris.com/pages/viewpage.action?pageId=125184421#TypeSysteminCore%2B-MixinTypes
in order to avoid renaming I would suggest to either use default methods (JAVA8 only) on a non generated Entity or Traits in Java7 https://wiki.hybris.com/display/release5/Using+Traits+with+Managed+Objects
Hope this could help. Matthias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Matthias.
But I tried to do the same using "mixin". But the problem is no new generated code for this new attribute. I am using Hybris 3.0. Is "mixin" feature supported in Hybris 3.0 version ?
If not, then I have to use "extends" property like below :
But, how to access the new attribute "splitted". Will it be possible to query the table using DummyOrderData object? I mean like below : getPersistenceManager().createCriteriaQuery(DummyOrderData .class).resultList()
I tried this, but without any luck. It is returning blank list although there is data available in table.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.