您的位置:首页 > 移动开发 > Objective-C

Issues in persisting dynamic entity and view objects using MDS

2015-08-18 11:57 609 查看


946347 2012-7-10
上午6:38

Hi All,

I'm trying to create dynamic entity and view objects per user session and to persist these objects throughout the session, I'm trying to use MDS configurations(either file or Database) in adf-config.xml.

I'm facing following two errors while trying to run the app module:

1. MDS error (MetadataNotFoundException): MDS-00013: no metadata found for metadata object "/model/DynamicEntityGenModuleOperations.xml"

2. oracle.mds.exception.ReadOnlyStoreException: MDS-01273: The operation on the resource /sessiondef/dynamic/DynamicDeptEntityDef.xml
failed because source metadata store mapped to the namespace / DEFAULT is read only.

I've gone through the following links which talks about the cause of the issue, but still can't figure out the issue in the code or the config file. Please help if, someone has faced a similar issue.

[http://docs.oracle.com/cd/E28271_01/doc.1111/e25450/mds_trouble.htm#BABIAGBG
|http://docs.oracle.com/cd/E28271_01/doc.1111/e25450/mds_trouble.htm#BABIAGBG
]

[http://docs.oracle.com/cd/E16162_01/core.1112/e22506/chapter_mds_messages.htm|http://docs.oracle.com/cd/E16162_01/core.1112/e22506/chapter_mds_messages.htm]

Attached is the code for dynamic entity/view object generation and corresponding adf-config.xml used.

///////////App Module Implementation Class/////////////////////////

public class DynamicEntityGenModuleImpl extends ApplicationModuleImpl implements DynamicEntityGenModule {

private static final String DYNAMIC_DETP_VO_INSTANCE = "DynamicDeptVO";

/**

* This is the default constructor (do not remove).

*/

public DynamicEntityGenModuleImpl() {

}

public ViewObjectImpl getDepartmentsView1() {

return (ViewObjectImpl) findViewObject("DynamicDeptVO");

}

public void buildDynamicDeptComp() {

ViewObject internalDynamicVO = findViewObject(DYNAMIC_DETP_VO_INSTANCE);

if (internalDynamicVO != null) {

System.out.println("OK VO exists, return Defn- " + internalDynamicVO.getDefFullName());

return;

}

EntityDefImpl deptEntDef = buildDeptEntitySessionDef();

ViewDefImpl viewDef = buildDeptViewSessionDef(deptEntDef);

addViewToPdefApplicationModule(viewDef);

}

private EntityDefImpl buildDeptEntitySessionDef() {

try {

EntityDefImpl entDef = new EntityDefImpl(oracle.jbo.server.EntityDefImpl.DEF_SCOPE_SESSION, "DynamicDeptEntityDef");

entDef.setFullName(entDef.getBasePackage() + ".dynamic." + entDef.getName());

entDef.setName(entDef.getName());

System.out.println("Application Module Path name: " + getDefFullName());

System.out.println("EntDef :" + entDef.getFileName() + " : " + entDef.getBasePackage() + ".dynamic." + entDef.getName());

entDef.setAliasName(entDef.getName());

entDef.setSource("DEPT");

entDef.setSourceType("table");

entDef.addAttribute("ID", "ID", Integer.class, true, false, true);

entDef.addAttribute("Name", "NAME", String.class, false, false, true);

entDef.addAttribute("Location", "LOCATION", Integer.class, false, false, true);

entDef.resolveDefObject();

entDef.registerSessionDefObject();

entDef.writeXMLContents();

entDef.saveXMLContents();

return entDef;

} catch (Exception ex) {

System.out.println(ex.getLocalizedMessage());

return null;

}

}

private ViewDefImpl buildDeptViewSessionDef(EntityDefImpl entityDef) {

try {

ViewDefImpl viewDef = new oracle.jbo.server.ViewDefImpl(oracle.jbo.server.ViewDefImpl.DEF_SCOPE_SESSION, "DynamicDeptViewDef");

viewDef.setFullName(viewDef.getBasePackage() + ".dynamic." + viewDef.getName());

System.out.println("ViewDef :" + viewDef.getFileName());

viewDef.setUseGlueCode(false);

viewDef.setIterMode(RowIterator.ITER_MODE_LAST_PAGE_FULL);

viewDef.setBindingStyle(SQLBuilder.BINDING_STYLE_ORACLE_NAME);

viewDef.setSelectClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT);

viewDef.setFromClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT);

viewDef.addEntityUsage("DynamicDeptUsage", entityDef.getFullName(), false, false);

viewDef.addAllEntityAttributes("DynamicDeptUsage");

viewDef.resolveDefObject();

viewDef.registerSessionDefObject();

viewDef.writeXMLContents();

viewDef.saveXMLContents();

return viewDef;

} catch (Exception ex) {

System.out.println(ex.getLocalizedMessage());

return null;

}

}

private void addViewToPdefApplicationModule(ViewDefImpl viewDef) {

oracle.jbo.server.PDefApplicationModule pDefAM = oracle.jbo.server.PDefApplicationModule.findDefObject(getDefFullName());

if (pDefAM == null) {

pDefAM = new oracle.jbo.server.PDefApplicationModule();

pDefAM.setFullName(getDefFullName());

}

pDefAM.setEditable(true);

pDefAM.createViewObject(DYNAMIC_DETP_VO_INSTANCE, viewDef.getFullName());

pDefAM.applyPersonalization(this);

pDefAM.writeXMLContents();

pDefAM.saveXMLContents();

}

}

////////adf-config.xml//////////////////////

<?xml version="1.0" encoding="windows-1252" ?>

<adf-config xmlns="http://xmlns.oracle.com/adf/config" xmlns:config="http://xmlns.oracle.com/bc4j/configuration" xmlns:adf="http://xmlns.oracle.com/adf/config/properties"

xmlns:sec="http://xmlns.oracle.com/adf/security/config">

<adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config">

<defaults useBindVarsForViewCriteriaLiterals="true"/>

<startup>

<amconfig-overrides>

<config:Database jbo.locking.mode="optimistic"/>

</amconfig-overrides>

</startup>

</adf-adfm-config>

<adf:adf-properties-child xmlns="http://xmlns.oracle.com/adf/config/properties">

<adf-property name="adfAppUID" value="TestDynamicEC-8827"/>

</adf:adf-properties-child>

<sec:adf-security-child xmlns="http://xmlns.oracle.com/adf/security/config">

<CredentialStoreContext credentialStoreClass="oracle.adf.share.security.providers.jps.CSFCredentialStore" credentialStoreLocation="../../src/META-INF/jps-config.xml"/>

</sec:adf-security-child>

<persistence-config>

<metadata-namespaces>

<namespace metadata-store-usage="mdsRepos" path="/sessiondef/"/>

<namespace path="/model/" metadata-store-usage="mdsRepos"/>

</metadata-namespaces>

<metadata-store-usages>

<metadata-store-usage default-cust-store="true" deploy-target="true" id="mdsRepos">

<metadata-store class-name="oracle.mds.persistence.stores.file.FileMetadataStore">

<property name="metadata-path" value="/tmp"/>

<!-- <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">

<property name="jndi-datasource" value="jdbc/TestDynamicEC"/>

<property name="repository-name" value="TestDynamicEC"/>

<property name="jdbc-userid" value="adfmay28"/>

<property name="jdbc-password" value="adfmay28"/>

<property name="jdbc-url" value="jdbc:oracle:thin:@localhost:1521:XE"/>-->

</metadata-store>

</metadata-store-usage>

</metadata-store-usages>

</persistence-config>

</adf-config>

//////////////////////////////////////////////////////////////////////////////////////////////////////////

121 查看

标签: adf_business_components

带有 adf_business_components 标记的内容
, jdev

带有 jdev 标记的内容
, mds

带有 mds 标记的内容


1. Re:
Issues in persisting dynamic entity and view objects using MDS





Frank
Nimphius-Oracle 2012-7-10 上午11:14 (回复
946347)

Hi,

MDS saves metadata no Java objects you create on the fly

Frank

喜爱 显示
0 喜欢(0)

操作


2. Re:
Issues in persisting dynamic entity and view objects using MDS





946347 2012-7-11
上午3:46 (回复
Frank Nimphius-Oracle)

Hi Frank,

I m trying to save entity and view object xml by calling writeXMLContents() and saveXMLContents() so that these objects can be retrieved using the xmls later on.

These methods internally use MDS configuration in adf-config.xml, which is creating the issue.

Please share your thoughts on resolving this or if, there is any other way of creating dynamic entity/view objects for db tables created at runtime.

Nik
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: