You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by sagarwal1 <sh...@gmail.com> on 2017/02/13 20:50:28 UTC

Camel tables created into db

Hi, I want to run Camel built application as stanalone. I am using maven to
create jar and execute route.
When I run MainApp.java main method from eclipse or run using camel run then
code runs as expected. But when I run using java -jar <classname> then 3
tables CAMEL_MESSAGEPROCESSED, CAMEL_MESSAGETRACED,hibernate_sequence are
created into db. I do not want these tables created. Can you please help me
what I am doing wrong.

Camel, camel-jpa version 2.19.1
hibernate-entitymanager version 5.2.7.Final

Camel-context.xml
<beans xmlns="http://www.springframework.org/schema/beans" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:prop="http://camel.apache.org/schema/placeholder"
	xmlns:camel="http://camel.apache.org/schema/spring"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
classpath:org/springframework/beans/factory/xml/spring-beans-4.3.xsd
     http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">



	<bean id="properties"
		class="org.apache.camel.component.properties.PropertiesComponent">
		<property name="location" value="classpath:db.properties" />
	</bean>

	<bean id="bridgePropertyPlaceholder"
		class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
		<property name="location" value="classpath:db.properties" />
	</bean>


	<camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">
		<routeBuilder ref="myBuilder" />
	</camelContext>


	<bean id="myBuilder"
		class="com.aexp.gsnt.insight.updateCentralData.InsightRouterBuilder" />

	
	<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
		<property name="entityManagerFactory" ref="entityManagerFactory" />
		<property name="transactionManager" ref="jpaTxManager" />
	</bean>
	<bean id="jpaTxManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
		<property name="entityManagerFactory" ref="entityManagerFactory" />
	</bean>
	<bean id="entityManagerFactory"
	
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="persistenceUnitName" value="persistenceUnit" />
		<property name="dataSource" ref="dataSource" />
		<property name="jpaVendorAdapter">
			<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
				<property name="databasePlatform"
value="org.hibernate.dialect.SQLServerDialect" />
				<property name="showSql" value="${showSQL}" />
				<property name="generateDdl" value="${generateDdl}" />
			</bean>
		</property>
		<property name="jpaProperties">
			<props>
				<prop key="hibernate.format_sql">${formatSQL}</prop>
			</props>
		</property>
	</bean>

	<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
		<property name="url" value="${jdbc.url}" />
		<property name="username" value="${username}" />
		<property name="password" value="${password}" />
	</bean>

</beans>

Persistence.xml
<?xml version="1.0" encoding="UTF-8" ?>
<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"
	version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
	<persistence-unit name="persistenceUnit"
		transaction-type="RESOURCE_LOCAL">
	</persistence-unit>
</persistence>

MainApp.java

import org.springframework.context.support.ClassPathXmlApplicationContext;
public class MainApp {

	private static ClassPathXmlApplicationContext
classPathXmlApplicationContext;

	/* Invoked from Jar */
	public static void main(String args[]) throws Exception {
		System.out.println("Started Central Data Extractor");
		System.setProperty("jsse.enableSNIExtension", "false");
		
		classPathXmlApplicationContext = new
ClassPathXmlApplicationContext("classpath:/META-INF/spring/camel-context.xml");
		classPathXmlApplicationContext.start();
	}

}







--
View this message in context: http://camel.465427.n5.nabble.com/Camel-tables-created-into-db-tp5793841.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Camel tables created into db

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Please use the user forum / @user mailing list for such kind of question.
Also search the internet how to turn off table creation in hibernate /
JPA as its there you should look and not Apache Camel.

On Mon, Feb 13, 2017 at 9:50 PM, sagarwal1 <sh...@gmail.com> wrote:
> Hi, I want to run Camel built application as stanalone. I am using maven to
> create jar and execute route.
> When I run MainApp.java main method from eclipse or run using camel run then
> code runs as expected. But when I run using java -jar <classname> then 3
> tables CAMEL_MESSAGEPROCESSED, CAMEL_MESSAGETRACED,hibernate_sequence are
> created into db. I do not want these tables created. Can you please help me
> what I am doing wrong.
>
> Camel, camel-jpa version 2.19.1
> hibernate-entitymanager version 5.2.7.Final
>
> Camel-context.xml
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:prop="http://camel.apache.org/schema/placeholder"
>         xmlns:camel="http://camel.apache.org/schema/spring"
>         xsi:schemaLocation="http://www.springframework.org/schema/beans
> classpath:org/springframework/beans/factory/xml/spring-beans-4.3.xsd
>      http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>
>
>         <bean id="properties"
>                 class="org.apache.camel.component.properties.PropertiesComponent">
>                 <property name="location" value="classpath:db.properties" />
>         </bean>
>
>         <bean id="bridgePropertyPlaceholder"
>                 class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
>                 <property name="location" value="classpath:db.properties" />
>         </bean>
>
>
>         <camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">
>                 <routeBuilder ref="myBuilder" />
>         </camelContext>
>
>
>         <bean id="myBuilder"
>                 class="com.aexp.gsnt.insight.updateCentralData.InsightRouterBuilder" />
>
>
>         <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
>                 <property name="entityManagerFactory" ref="entityManagerFactory" />
>                 <property name="transactionManager" ref="jpaTxManager" />
>         </bean>
>         <bean id="jpaTxManager"
> class="org.springframework.orm.jpa.JpaTransactionManager">
>                 <property name="entityManagerFactory" ref="entityManagerFactory" />
>         </bean>
>         <bean id="entityManagerFactory"
>
> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
>                 <property name="persistenceUnitName" value="persistenceUnit" />
>                 <property name="dataSource" ref="dataSource" />
>                 <property name="jpaVendorAdapter">
>                         <bean
> class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
>                                 <property name="databasePlatform"
> value="org.hibernate.dialect.SQLServerDialect" />
>                                 <property name="showSql" value="${showSQL}" />
>                                 <property name="generateDdl" value="${generateDdl}" />
>                         </bean>
>                 </property>
>                 <property name="jpaProperties">
>                         <props>
>                                 <prop key="hibernate.format_sql">${formatSQL}</prop>
>                         </props>
>                 </property>
>         </bean>
>
>         <bean id="dataSource"
>                 class="org.springframework.jdbc.datasource.DriverManagerDataSource">
>                 <property name="driverClassName"
> value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
>                 <property name="url" value="${jdbc.url}" />
>                 <property name="username" value="${username}" />
>                 <property name="password" value="${password}" />
>         </bean>
>
> </beans>
>
> Persistence.xml
> <?xml version="1.0" encoding="UTF-8" ?>
> <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"
>         version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
>         <persistence-unit name="persistenceUnit"
>                 transaction-type="RESOURCE_LOCAL">
>         </persistence-unit>
> </persistence>
>
> MainApp.java
>
> import org.springframework.context.support.ClassPathXmlApplicationContext;
> public class MainApp {
>
>         private static ClassPathXmlApplicationContext
> classPathXmlApplicationContext;
>
>         /* Invoked from Jar */
>         public static void main(String args[]) throws Exception {
>                 System.out.println("Started Central Data Extractor");
>                 System.setProperty("jsse.enableSNIExtension", "false");
>
>                 classPathXmlApplicationContext = new
> ClassPathXmlApplicationContext("classpath:/META-INF/spring/camel-context.xml");
>                 classPathXmlApplicationContext.start();
>         }
>
> }
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-tables-created-into-db-tp5793841.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2