I have a existing table in database. I have modified service.xml as follows :-
Service.xml :-
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">
<service-builder package-path="net.test">
<author>pfeffeg</author>
<namespace>dataaccess</namespace>
<entity name="test" remote-service="true" local-service="true">
<column name="PID" type="long"></column>
<column name="PName" type="String"></column>
<column name="IID" type="long" primary="true"></column>
<column name="iName" type="String"></column>
</entity>
</service-builder>
Create table query:-
CREATE TABLE [dbo].[dataaccess_test](
[PID] [bigint] NULL,
[PName] [varchar](max) NULL,
[IID] [bigint] NOT NULL,
[iName] [varchar](max) NULL,
CONSTRAINT [pk_IdetailidTest] PRIMARY KEY CLUSTERED
(
[IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
I have built the service builder. All classes have apparently been built correctly. but when i try to run the portlet I am getting a Bean Locator exception.
BeanLocator has not been set
com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set
at com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.locate(PortletBeanLocatorUtil.java:40)
What liferay version are you are you working with?
And please post the whole service.xml file. This error is usually derivated from errors in service.xml file.
Thanks aritzg, I am now able to execute the portlet without errors. The solution -
column name attribute in service.xml should start with a capital letter. Looks strange but it worked for me.
service.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">
<service-builder package-path="net.test">
<author>pfeffeg</author>
<namespace>dataaccess</namespace>
<entity name="test" remote-service="true" local-service="true">
<column name="PID" type="long"></column>
<column name="PName" type="String"></column>
<column name="IID" type="long" primary="true"></column>
<column name="IName" type="String"></column>
</entity>
</service-builder>
Related
hi created several scripts for importing nodes into zabbix, this all works as it should except when in my import file is a node with a hostgoup name that doesn't match any groups in Zabbix
In an ideal world I would like to create the hostgoup when it doesn't exist.
I tried to add the host group bit to the xml file but that's obviously not the right way
<?xml version='1.0' encoding='UTF-8'?>
<zabbix_export>
<version>6.2</version>
<date>2022-12-26T17:16:35Z</date>
<hostgroups>
<hostgroup>
<name>TESTERS</name>
</hostgroup>
</hostgroups>
<hosts>
<host>
</host>
</hosts>
</zabbix_export>
I just tried exporting an host from Zabbix 5, and importing to a different Zabbix 5, and it works. It created the missing host groups.
In the import procedure, be sure to select "Create new groups".
The XML generated by Zabbix was:
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2023-01-05T08:56:23Z</date>
<groups>
<group>
<name>customer: foo</name>
</group>
<group>
<name>platform: WINDOWS</name>
</group>
</groups>
<hosts>
<host>
<host>myserver</host>
<name>myserver - test</name>
<proxy>
<name>myproxy</name>
</proxy>
<templates>
<template>
<name>Template VM VMware</name>
</template>
</templates>
<groups>
<group>
<name>customer: foo</name>
</group>
...
I have an sql looks like this.
<sql name="level1">
${alias}some AS ${prefix}some
</sql>
Now I want to nest above fragment into another fragment while propagating those two properties.
<sql name="level2">
${alias}other AS ${prefix}other,
<include refid="level1">
<property name="alias" value="${alias}"/> <!-- will this "${alias}" work? -->
<property name="prefix" value="${prefix}"/> <!-- will this "${prefix}" work? -->
</include>
</sql>
My apologies, I should've tried for myself and saw what happened. But I'm working on a remote site and the testing environment is not complete.
I have a JPA application running, and now I want to support multi-tenancy. I like to use XML instead of annotations.
I have a couple of orm.xml referenced from persistence.xml.
<entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
version="2.0">
<package>mypackage</package>
<entity class="Foo" />
<entity class="Bar" />
</entity-mappings>
I like to use the same multi-tenancy configuration for all entities:
single-table, discriminator column is tenantUserId, context-property is tenant.userId.
According to:
https://wiki.eclipse.org/EclipseLink/Examples/JPA/EclipseLink-ORM.XML
<tenant-discriminator-column name="tenantUserId" context-property="tenant.userId"/>
Whether to put the line above? I tried to create eclipselink-orm.xml as following
<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_1.xsd"
version="2.1">
<tenant-discriminator-column name="tenantUserId" context-property="tenant.userId"/>
<persistence-unit-metadata>
<persistence-unit-defaults>
<tenant-discriminator-column name="tenantUserId" context-property="tenant.userId"/>
</persistence-unit-defaults>
</persistence-unit-metadata>
</entity-mappings>
Both are invalid according to the schema. Where to put eclipselink-orm.xml?
Is there a way to say that: all entities are multi-tenant(single table)? Do I have to specify them for all entities one by one?
<entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
version="2.0">
<package>mypackage</package>
<entity class="Foo" >
<multi-tenant/>
</entity>
<entity class="Bar" >
<multi-tenant/>
</entity>
</entity-mappings>
Thanks.
From http://www.eclipse.org/eclipselink/documentation/2.5/solutions/multitenancy002.htm
you are using the persistence unit default correctly as:
<persistence-unit-metadata>
<persistence-unit-defaults>
<tenant-discriminator-column name="tenantUserId" context-property="tenant.userId"/>
</persistence-unit-defaults>
</persistence-unit-metadata>
The problem is you are using the wrong schema version. 2.1 did not include multitenant features, so you need to use the 2.5 xds, eclipselink_orm_2_5.xsd. This should be in the eclipselink.jar or pulled from git as James describes here http://git.eclipse.org/c/eclipselink/eclipselink.runtime.git/tree/jpa/org.eclipse.persistence.jpa/resource/org/eclipse/persistence/jpa
I am having issues with a FetchXML query running against Dynamics CRM 2013 (online).
When running this simple query
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" count="5">
<entity name="activitypointer">
<attribute name="activityid" alias="activity_id" />
<attribute name="activitytypecode" alias="activity_type" />
<attribute name="ownerid" alias="owner" />
</entity>
</fetch>
I get the expected results for the activity_type column e.g. "email", "opportunityclose" etc.
But when I attempt this aggregate version of the same query
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true">
<entity name="activitypointer">
<attribute name="activityid" alias="activity_count" aggregate="count" />
<attribute name="activitytypecode" alias="activity_type" groupby="true" />
<attribute name="ownerid" alias="owner" groupby="true" />
</entity>
</fetch>
I get the correct results for the activity_count and owner columns, but the "activity_type" column is populated with just "Microsoft.Xrm.Sdk.OptionSetValue" or if ran within a report "#error".
I assume this is something to do with grouping by an option field type.
Does anyone know how to resolve this issue?
You have to be very careful when it comes with nulls and grouping. Try adding a filter that excludes null values. I have verified in 2011 that it does return a valid value for Option Sets.
I can fill 2 tables in a DB where the tables have mappings(one table has a FK from he other). The
EclipseLink DataSource show the flush to the DB has been done ok.
I am trying to rewrite the tables (with same data a second time ) while the persistence.xml has
the properties clause as follows :
<property name="eclipselink.ddl-generation" value="drop-create-tables" />
yet I see no dropping (erase) of the previous tables before the rewriting and therefore get rejected with the following exception message about a duplicate key :
"Internal Exception:
java.sql.SQLIntegrityConstraintViolationException: The statement was
aborted because it would have caused a duplicate key value in a unique
or primary key constraint or unique index identified by
'SQL120206135740510' defined on 'HOST'. " ( HOST is the table pointed
to by the FK).
What am I missing in the persistence.xml or else that should make the table drop before the rewrite ?
Below see the persistence.xml file ( the DB file is called 'test' . The schema is name after the user name (APP in my case) ):
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="jpa_test">
<class>Host</class>
<class>Vm</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:derby://im6-64s:1527/test;create=true" />
<property name="javax.persistence.jdbc.user" value="APP" />
<property name="javax.persistence.jdbc.password" value="passw0rd" />
<!-- EclipseLink should create the database schema automatically -->
<property name="eclipselink.ddl-generation" value="drop-create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
</properties>
</persistence-unit>
</persistence>
"drop-create-tables" should be "drop-and-create-tables"
Try adding the "eclipselink.logging.level" property with a value of Finest or ALL to see why the drop might not be being executed.