You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Evgeny Shepelyuk <es...@gmail.com> on 2007/09/20 10:45:09 UTC

Queries when creating EntityManager

	Hello!

Im using OpenJPA with Spring transactional management and EntityManager  
injection to DAO under Postgresql 8.2.1

Seems when new EntityManager is created those queries are executing to  
database

SELECT t.typlen FROM pg_catalog.pg_type t, pg_catalog.pg_namespace n WHERE  
t.typnamespace=n.oid AND t.typname='name' AND n.nspname='pg_catalog'
SELECT setting FROM pg_catalog.pg_settings WHERE name='max_index_keys'


Can anyone help with this issue ?
My question is can those queries be removed by adjusting some settings in  
JPA configuration ?

-- 
Best Regards
Evgeny K. Shepelyuk

Re: Queries when creating EntityManager

Posted by ben short <ja...@gmail.com>.
Do you want to turn of the logging of sql?

You'll need to set on of the log properties [1] but I'm not sure which
one relates to the sql being logged, sorry.

You can do this as show below..

<!-- JPA EntityManagerFactory -->
	<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="dataSource"/>
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
                <property name="database" value="POSTGRESQL"/>
                <property name="showSql" value="true" />
                <property name="generateDdl" value="true" />
            </bean>
		</property>
        <property name="jpaProperties">
            <props>
                <prop key="openjpa.jdbc.SynchronizeMappings"
>buildSchema(ForeignKeys=true)</prop>
                <prop key="openjpa.Log">DefaultLevel=TRACE, Tool=TRACE</prop>
            </props>
        </property>
    </bean>

[1] http://openjpa.apache.org/builds/1.0.0/apache-openjpa-1.0.0/docs/manual/ref_guide_conf_openjpa.html#openjpa.Log

On 9/20/07, Evgeny Shepelyuk <es...@gmail.com> wrote:
>         Hello!
>
> Im using OpenJPA with Spring transactional management and EntityManager
> injection to DAO under Postgresql 8.2.1
>
> Seems when new EntityManager is created those queries are executing to
> database
>
> SELECT t.typlen FROM pg_catalog.pg_type t, pg_catalog.pg_namespace n WHERE
> t.typnamespace=n.oid AND t.typname='name' AND n.nspname='pg_catalog'
> SELECT setting FROM pg_catalog.pg_settings WHERE name='max_index_keys'
>
>
> Can anyone help with this issue ?
> My question is can those queries be removed by adjusting some settings in
> JPA configuration ?
>
> --
> Best Regards
> Evgeny K. Shepelyuk
>

Re: Queries when creating EntityManager

Posted by Evgeny Shepelyuk <es...@gmail.com>.
20.09.07 в 12:02 Patrick Linskey в своём письме писал(а):

> Hi,
>
> Can you post your current persistence.xml file?

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="pu1" transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
..... my entities ....
<properties>
	<property name="openjpa.ConnectionURL"  
value="jdbc:postgresql://localhost:5432/test"/>
	<property name="openjpa.ConnectionDriverName"  
value="org.postgresql.Driver"/>
	<property name="openjpa.ConnectionUserName" value="test"/>
	<property name="openjpa.ConnectionPassword" value="test"/>
	<property name="openjpa.Log" value="log4j"/>
</properties>
</persistence-unit>
</persistence>


> I don't think that OpenJPA directly issues these statements. Where are
> you seeing them being logged?

In logs of postgres. I torned on postmaste's storing of all queries it  
executes.

-- 
Best Regards
Evgeny K. Shepelyuk

Re: Queries when creating EntityManager

Posted by Patrick Linskey <pl...@gmail.com>.
Hi,

Can you post your current persistence.xml file?

I don't think that OpenJPA directly issues these statements. Where are
you seeing them being logged? I'd guess that maybe they're a result of
some DatabaseMetaData calls while the LazySchemaFactory is looking for
indexes.

-Patrick

On 9/20/07, Evgeny Shepelyuk <es...@gmail.com> wrote:
>         Hello!
>
> Im using OpenJPA with Spring transactional management and EntityManager
> injection to DAO under Postgresql 8.2.1
>
> Seems when new EntityManager is created those queries are executing to
> database
>
> SELECT t.typlen FROM pg_catalog.pg_type t, pg_catalog.pg_namespace n WHERE
> t.typnamespace=n.oid AND t.typname='name' AND n.nspname='pg_catalog'
> SELECT setting FROM pg_catalog.pg_settings WHERE name='max_index_keys'
>
>
> Can anyone help with this issue ?
> My question is can those queries be removed by adjusting some settings in
> JPA configuration ?
>
> --
> Best Regards
> Evgeny K. Shepelyuk
>


-- 
Patrick Linskey
202 669 5907