Composite index in datastore-index.xml not created - google-app-engine

Here is my datastore-index file:
<?xml version="1.0" encoding="utf-8"?>
<datastore-indexes autoGenerate="true">
<datastore-index kind="Stock" ancestor="false" source="manual">
<property name="code" direction="asc" />
<property name="endTime" direction="asc" />
</datastore-index>
</datastore-indexes>
The index entry was created exactly as suggested by App Engine in error log.
I put the index file in folder webapp/WEB-INF.
Despite all my efforts, no index were necer displayed on the Datastore index page and when I query I get the same error message: no matching index found.
Could you help me?

Related

MDB not persisting data in sql server

I have MDB configured to receive incoming message and persist it via a SLSB using JPA (eclipseLink). The database inserts work for one off message but in load conditions (3 or 4 messages per second), Data is not persisted in DB. I can see sql Insert queries in the log but no data in DB.
Persistence File:
<?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="mainPU" transaction-type="JTA"> -->
<persistence-unit name="mainPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>ecpcPool</jta-data-source>
<class>com.fc.ECP.domain.Address</class>
<class>com.fc.ECP.domain.Customer</class>
<class>com.fc.ECP.domain.DocumentationSignature</class>
<class>com.fc.ECP.domain.EcpSystem</class>
<class>com.fc.ECP.domain.EcpTransaction</class>
<class>com.fc.ECP.domain.EcpWkflw</class>
<class>com.fc.ECP.domain.EidVerify</class>
<class>com.fc.ECP.domain.EsignDetail</class>
<class>com.fc.ECP.domain.Finpln</class>
<class>com.fc.ECP.domain.FinplnDocumentation</class>
<class>com.fc.ECP.domain.ThirdPartyCrdntl</class>
<class>com.fc.ECP.domain.ThirdPartyDocumentation</class>
<class>com.fc.ECP.domain.TransactionType</class>
<class>com.fc.ECP.domain.Advice</class>
<class>com.fc.ECP.domain.Advcln</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="eclipselink.target-server" value="WebLogic_10"
/>
<property name="javax.persistence.jtaDataSource"
value="ecpcPool" />
<!-- <property name="javax.persistence.jtaDataSource"
value="jdbc/MicrosoftSQLServer"/> -->
<!-- <property name="javax.persistence.jtaDataSource"
value="ecp_prx_ds"/> -->
<property name="eclipselink.target-database"
value="org.eclipse.persistence.platform.database.SQLServerPlatform" />
<property name="eclipselink.session.customizer"
value="com.fc.adr.jpa.JPASessionCustomizer" />
<property name="com.fc.adr.jpa.schema" value="$(mainPU.schema)"
/>
<property name="com.fc.adr.jpa.schema.sequences"
value="$(mainPU.schema.sequences)" />
<property name="eclipselink.logging.logger"
value="DefaultLogger" />
<property name="eclipselink.logging.level.sql" value="FINE" />
<property name="eclipselink.logging.level" value="FINE" />
<property name="eclipselink.logging.parameters" value="true" />
<property name="eclipselink.persistence-context.flush-mode"
value="commit" />
</properties>
</persistence-unit>
</persistence>
Switch to EJB2 style config for MDB.
Underlying Cause:
The EJB3 style MDB ‘s methods are wrapped by CDI injection.
One of the wrapper classes in the stack trace is: com.oracle.pitchfork.intercept.MethodInvocationInvocationContext
which is in a spring framework module jar in weblogic
MethodInvocationInvocationContext looks for a WebServiceContext in the JNDI tree at “java:comp/WebServiceContext”
Having a jax-ws service puts a WebServiceContext at “java:comp/WebServiceContext”
If the WebServiceContext is present, then MethodInvocationInvocationContext tries to access its values for the MessageDrivenContext
The spec requires WebServiceContext to throw an IllegalStateException if it is accessed outside of a web service call

Configuring 2 database in mybatis + springs

I have an existing setup of mybatis + springs for working with Oracle DB. I have a set of java mapper interfaces, a set of corresponding mapper xmls (each having reference to their corresponding java mapper). I need to setup support for MSSQL also, but finding it hard to do that. I have created a separate set of xmls (specific to queries of MSSQL) in com/mycomp/mob/db/mappers/mssql.
Below is the extract of my applicationConext.xml (Here DBDataSource is an internal class which reads a config files to get all DB details).
<bean name="dataSource" class="com.mycomp.mob.core.db.DBDataSource">
<constructor-arg index="0" name="dbAlias" value="mob" />
<constructor-arg index="1" name="cfgSection" value="primary" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.mycomp.mob.db.mappers.oracle" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="typeAliasesPackage" value="com.mycomp.mob.db.mappers.oracle" />
<property name="configLocation" value="classpath:mybatis-config.xml" />
</bean>
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactory" />
</bean>
Below is part of mybatis-config.xml (here ${} params are replaced using the earlier DBDatasource)
<configuration>
<typeAliases>
<package name="com.mycomp.mob.db.model" />
</typeAliases>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<dataSource type="POOLED">
<property name="driver" value="${driver}" />
<property name="url" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="com/mycomp/mob/db/mappers/oracle/tenant.xml" />
<mapper resource="com/mycomp/mob/db/mappers/oracle/functionenty.xml" />
</mappers>
</configuration>
com.mycomp.mob.db.model contains POJO for tenant and functionentry.
Usage is as below :
ITenantMapper mappper = sqlSessionFactory.openSession().getMapper(ItenantMapper.class)
Tenant t = mapper.getTenant();
Now at a time only one DB (which is configured as primary in DB config file) will be used. So how to make sure that XML corresponding to that particular DB is invoked by the java mapper interface.
Also need to know can I configure same java mapper class name inside the mapper xmls of mssql ?
Is the flow used correct or I need to change the flow for supporting multiple databases.
Create two datasources and two SessionFactories in spring one for Oracle another for MSSQL.

Rename Liquibase changelog tables

I'm using Liquibase (v 3.0.7) together with Spring (v 4.0.0):
<!-- Liquibase configuration -->
<bean id = "liquibase" class = "liquibase.integration.spring.SpringLiquibase">
<property name = "dataSource" ref = "dataSource" />
<property name = "changeLog" value = "classpath:database/changelog.xml" />
</bean>
Once I've deployed my Spring application, Liquibase will create two tables: databasechangelog and databasechangeloglock. Is there a way to rename those two tables?
You can use system properties to override the default table names.
Or you can use small workaround to setup this names in spring configuration, check this answer for Java configuration - https://stackoverflow.com/a/50644347 or you can use this for xml configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="liquibaseSystemPropsSetter"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" value="#{#systemProperties}"/>
<property name="targetMethod" value="putAll"/>
<property name="arguments">
<util:properties>
<prop key="liquibase.databaseChangeLogTableName">${application.liquibase.change.log.table.name}</prop>
<prop key="liquibase.databaseChangeLogLockTableName">${application.liquibase.change.log.lock.table.name}
</prop>
</util:properties>
</property>
</bean>
<bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase"
depends-on="liquibaseSystemPropsSetter"
p:dataSource-ref="localDataSource"
p:changeLog="classpath:${application.liquibase.change.log.path}"
p:shouldRun="${application.liquibase.should.run}"/>
</beans>

Is it possible to use both routeContextRef and dataFormats elements in a camelContext?

When I attempt to do so, I get:
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 35 in XML document from class path resource [META-INF/spring/camel-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 35; columnNumber: 55; cvc-complex-type.2.4.a: Invalid content was found starting with element 'routeContextRef'. One of '{"http://camel.apache.org/schema/spring":redeliveryPolicyProfile, "http://camel.apache.org/schema/spring":onException, "http://camel.apache.org/schema/spring":onCompletion, "http://camel.apache.org/schema/spring":intercept, "http://camel.apache.org/schema/spring":interceptFrom, "http://camel.apache.org/schema/spring":interceptSendToEndpoint, "http://camel.apache.org/schema/spring":route}' is expected.
Checking the schema, it is apparently true that it's not possible to define routes within a routeContext that can use dataFormat since dataFormats elements must follow routeContextRef elements.
Do I need to abandon the routeContext organizational approach and put all my routes in a single file?
Here is a slightly bowdlerized version of the camel context. I need to be able to use json in cContext.
<?xml version="1.0" ?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
</property>
</bean>
<import resource="classBeanDefs.xml"/>
<import resource="a.xml"/>
<import resource="b.xml"/>
<import resource="c.xml"/>
<camelContext id="camel" trace="false" xmlns="http://camel.apache.org/schema/spring">
<propertyPlaceholder id="properties"
location="classpath:route.properties"
xmlns="http://camel.apache.org/schema/spring"/>
<dataFormats>
<json id="json" library="Jackson"/>
</dataFormats>
<routeContextRef ref="aContext"/>
<routeContextRef ref="bContext"/>
<routeContextRef ref="cContext"/>
</camelContext>
</beans>
I get a similar error when I try to add the dataFormats element to the routeContext, which the schema clearly doesn't approve of.
You should have your routeContextRef before the dataFormats.

Example Databases

I am new to oracle. I wanted a huge sample database ( with a million tuples ) . I couldn't find any using google.
I'am using oracle 10g..
You guys know anywhere from where i can download?
Thank you ..
I don't know of any "ready-made" sample database of that size
As far as I can see, you have two options:
Use PolePosition to create a sample database. It's originally a benchmark frameworks but comes with it's own database schema and the necessary tools to generate a large database (you can define which size)
Use a test data generator like Benerator to completely create your test data from scratch. It seems a bit intimidating at first, but it's a really powerful tool. It also has generators to create meaningful names, zip codes and so on. So you'll get test data that "looks" real and doesn't contain gibberish.
The following benerator script generates a million rows for the table items and for each row in items it generates 10 rows in item_details (so you wind up with 1 million and 10 million rows)
<?xml version="1.0" encoding="iso-8859-1"?>
<setup xmlns="http://databene.org/benerator/0.7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://databene.org/benerator/0.7.0 http://databene.org/benerator-0.7.0.xsd">
<import defaults="true"/>
<import platforms="csv"/>
<generate type="items" count="1000000">
<consumer class="org.databene.platform.csv.CSVEntityExporter">
<property name="uri" value="items.csv"/>
<property name="separator" value="|"/>
<property name="encoding" value="ISO-8859-1"/>
</consumer>
<id name="item_id" type="big_integer" generator="IncrementalIdGenerator"/>
<attribute name="item_name" type="string" pattern="[A-Z][a-z ]{6,25}"/>
<generate type="item_details" count="10">
<consumer class="org.databene.platform.csv.CSVEntityExporter">
<property name="uri" value="item_details.csv"/>
<property name="separator" value="|"/>
<property name="encoding" value="ISO-8859-1"/>
</consumer>
<id name="item_detail_id" type="big_integer" generator="IncrementalIdGenerator"/>
<attribute name="item_id" script="items.item_id"/>
<attribute name="sort_sequence" type="int" />
</generate>
</generate>
</setup>
If you want more "realistic" names, have a look a the following script which generates products with valid EAN Codes and some "normal" looking manufacturer names:
<?xml version="1.0" encoding="iso-8859-1"?>
<setup xmlns="http://databene.org/benerator/0.7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://databene.org/benerator/0.7.0 http://databene.org/benerator-0.7.0.xsd">
<import platforms="csv"/>
<import domains="product"/>
<import domains="organization" />
<setting name="product_count" value="100000"/>
<generate type="product" count="{product_count}">
<consumer class="CSVEntityExporter">
<property name="uri" value="products.csv" />
<property name="separator" value=","/>
</consumer>
<id name="id" type="long"/>
<attribute name="ean_code" unique="true" generator="EANGenerator"/>
<attribute name="product_code" unique="true" pattern="[A-Z]{3}[0-9]{6}"/>
<variable name="cust" generator="CompanyNameGenerator" dataset="DE" locale="de_DE"/>
<attribute name="manufacturer_name" source="cust.shortName"/>
</generate>
</setup>
Once you have created the data files, you can use SQL*Loader to import them into the database.
This approach has the advantage that you have full control over the tables in your test database and you can tailor them to whatever you are trying to do with it.

Resources