Giter VIP home page Giter VIP logo

spring-data-jdbc-ext's Introduction

NOTICE: This project has been archived as of March 27th, 2019. There will be no maintenance or new development going forward.

Spring Data JDBC Extensions for the Oracle database

The primary goal of the Spring Data project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.

There are still many good uses for a relational database and this modules provides an improved programming model for working with legacy and advanced features of the Oracle database.

Docs

You can find out more details from the user documentation or by browsing the javadocs.

Artifacts

All you need to do to include the project in your project is shown on the project page

Building

NOTE: Before you build the project you will need to download the necessary Oracle jars and import them into your local Maven repository. See spring-data-oracle/README.txt for more details on how to obtain and install these jars.

For building the project you should use Java SDK version 1.7.

Spring Data JDBC Extensions uses Gradle as its build system. To build the project run:

./gradlew build

from the project root folder. This will compile the sources, run the tests and create the artifacts.

To generate IDE-specific files, use

./gradlew eclipse

or

./gradlew idea

depending on your editor.

Contributing

Here are some ways for you to get involved in the community:

  • Get involved with the Spring community by helping out on stackoverflow by responding to questions and joining the debate.
  • Create GitHub issues for bugs and new features and comment and vote on the ones that you are interested in.
  • Github is for social coding: if you want to write code, we encourage contributions through pull requests from forks of this repository. If you want to contribute code this way, please reference a JIRA ticket as well covering the specific issue you are addressing.
  • Watch for upcoming articles on Spring by subscribing to spring.io

Before we accept a non-trivial patch or pull request we will need you to sign the contributor's agreement. Signing the contributor's agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.

spring-data-jdbc-ext's People

Contributors

davidkarlsen avatar mteufel avatar odrotbohm avatar spring-builds avatar spring-operator avatar trisberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-data-jdbc-ext's Issues

Return values need to be documented better

Documentation of QueryDslJdbcOperations needs fixing on return values. For example
https://github.com/spring-projects/spring-data-jdbc-ext/blob/master/spring-data-jdbc-core/src/main/java/org/springframework/data/jdbc/query/QueryDslJdbcOperations.java#L113 needs fixing. @return should be "the mapped object or null if no row was found" or similar.

Btw. returning null instead of throwing an exception is not in line with the implementation of JdbcTemplate.

Custom Types support ?

Is there a way of supporting CustomTypes as QueryDSL suggest in its documentation?

2.3.20. Custom types
Querydsl SQL provides the possibility to declare custom type mappings for ResultSet/Statement > > > interaction. The custom type mappings can be declared in com.mysema.query.sql.Configuration
instances, which are supplied as constructor arguments to the actual queries:

Configuration configuration = new Configuration(new H2Templates());
// overrides the mapping for Types.DATE
configuration.register(new UtilDateType());
And for a table column

Configuration configuration = new Configuration(new H2Templates());
// declares a maping for the gender column in the person table
configuration.register("person", "gender", new EnumByNameType(Gender.class));
To customize a numeric mapping you can use the registerNumeric method like this

configuration.registerNumeric(5,2,Float.class);
This will map the Float type to the NUMERIC(5,2) type."

SqlReturnStruct NPE when plsql function returns null

When using SqlReturnStruct, if the plsql function being called returns null, a NPE is thrown. I would expect it to do a null check before trying to process the STRUCT and return null in this case, but correct me if my expectation is wrong.

Here's the code in question which I think should do a null check before processing:

    public Object getTypeValue(CallableStatement cs, int paramIndex, int sqlType, String typeName)
            throws SQLException {
        STRUCT struct = (STRUCT)cs.getObject(paramIndex);
        Object result = mapper.fromStruct(struct);
        return result;
    }

I'm using spring-data-jdbc-core 1.0.0.RELEASE and spring-data-oracle 1.0.0.RELEASE

Here's the stacktrace:

java.lang.NullPointerException
    at org.springframework.data.jdbc.support.oracle.BeanPropertyStructMapper.fromStruct(BeanPropertyStructMapper.java:202)
    at org.springframework.data.jdbc.support.oracle.SqlReturnStruct.getTypeValue(SqlReturnStruct.java:78)
    at org.springframework.jdbc.core.JdbcTemplate.extractOutputParameters(JdbcTemplate.java:1164)
    at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1082)
    at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1070)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1020)
    at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1070)
    at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:144)
    at edu.liberty.memberships.repository.StudentAccessTermDaoImpl.getStudentAccessTerm(StudentAccessTermDaoImpl.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at com.sun.proxy.$Proxy73.getStudentAccessTerm(Unknown Source)
    at edu.liberty.memberships.repository.StudentAccessTermDaoImplTest.testGetStudentAccessTerm_NonStudent(StudentAccessTermDaoImplTest.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
    at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Thanks!

OracleXmlHandler.getXmlAsString throws NPE instead of returning null

According to the documentation for SqlXmlHandler's getXmlAsString it should return the given column as String or null in case of SQL NULL, OracleXmlHandler's implementation throws a NullPointerException instead.

The default implementation (Jdbc4SqlXmlHandler) has the same behavior. So it seems to me that there's a discrepancy between the documentation and the implementation.

Update Spring version

At the moment Spring Data JDBC still uses Spring 3.0. Would be nice if it would be build against a still supported version preferably on the 4.x range but at least the 3.2.x range.

Bug in Class org.springframework.data.jdbc.support.oracleProxyConnectionPreparer

Hello,

I think there is a Bug on Line 73 on org.springframework.data.jdbc.support.oracleProxyConnectionPreparer

Connection nativeCon = jdbcExtractor.getNativeConnection(connection);
if (nativeCon instanceof OracleConnection) {
oraCon = (OracleConnection) connection; This will throw a ClassCastException!
}

It should be:
Connection nativeCon = jdbcExtractor.getNativeConnection(connection);
if (nativeCon instanceof OracleConnection) {
oraCon = (OracleConnection) nativeCon;
}

SQLServer Connection is null when trying to select data with QueryDslJdbcTemplate but OK with JdbcTemplate and native SQLQuery

Hi

I'm testing with Spring boot 1.2.0 + spring data jdbc 1.1.0 + Querydsl 3.6

I initilalized QueryDSlTemplate like below:

@Bean
public SQLTemplates sqlTemplates() {
    return SQLServer2008Templates.builder()
            .printSchema() // to include the schema in the output
            .quote() // to quote names
            .newLineToSingleSpace() // to replace new lines with single space in the output
            .build();   
}

@Bean(name = "qt1")
public QueryDslJdbcTemplate queryDslJdbcTemplate(JdbcTemplate jdbcTemplate, SQLTemplates sqlTemplates) {
    return new QueryDslJdbcTemplate(jdbcTemplate, sqlTemplates);
}

@Bean(name = "qt2")
public QueryDslJdbcTemplate queryDslJdbcTemplate(DataSource dataSource) {
    return new QueryDslJdbcTemplate(dataSource);
}

I'm testing offset() so need SQL2008Template.

anyway, test code is below:

@Autowired
DataSource dataSource;
@Autowired
SQLTemplates dialect;
@Autowired
@Qualifier("qt1")
QueryDslJdbcTemplate template;
@Autowired
@Qualifier("qt2")
QueryDslJdbcTemplate template2;

@Autowired
JdbcTemplate jdbcTemplate;

@Test
public void queryDslTest() throws SQLException {
    QFxmatch fxmatch = new QFxmatch("fx");

    SQLQuery query = new SQLQuery(dataSource.getConnection(), dialect);
    List<Fxmatch> list = query.from(fxmatch)
        .where(fxmatch.type.eq("A")
        .and(fxmatch.msgtype.eq("300")))
        .orderBy(fxmatch.sasrn.asc())
        .limit(5)
        .offset(2)
        .list(fxmatch);

    log.info(list.toString());
}

@Test
public void queryDslTestSpring()  {
    try {

        List<Map<String, Object>> sdd = jdbcTemplate.queryForList("SELECT * FROM FXMATCH");

        QFxmatch fxmatch = new QFxmatch("fx");

        List<Fxmatch> list = template2.newSqlQuery().from(fxmatch)
            .where(fxmatch.type.eq("A")
            .and(fxmatch.msgtype.eq("300")))
            .orderBy(fxmatch.sasrn.asc())
            .limit(3)
            .list(fxmatch);

        log.info(list.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

queryDslTest() method works perfect, gave me the data. See that I'm usign autowired datasource.

queryDslTestSpring(), jdbcTemplate query workking OK, but template2.newSqlQuery(), or template.newSqlQuery(), gave below error:

java.lang.NullPointerException at com.mysema.query.sql.AbstractSQLQuery.list(AbstractSQLQuery.java:308) at com.global.swift.fx.QueryDSLTest.queryDslTestSpring(QueryDSLTest.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:217) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

I look to the source code, and Connection object is null.

Misspelled XML Namespace Declarations

XmlMessageListenerContainer ignores message selector.

Class XmlMessageListenerContainer ignores message selector and creates consumer without it. The same problem I found in AdtMessageListenerContainer.

Instead of

return ((AQjmsSession) session).createConsumer(destination, null, XMLType.getORADataFactory(), null, false);

use

return ((AQjmsSession) session).createConsumer(destination, getMessageSelector(), XMLType.getORADataFactory(), null, false);

Native JDBC Extractor only using DB txns

The only reference to nativeJdbcExtractor is in the Transaction Aware Datasrouce wrapper. This should also be used when this option is not selected (the default).

This code is in: spring-data-oracle/src/main/java/org/springframework/data/jdbc/config/oracle/AqJmsFactoryBeanFactory.java

try {
conToUse = nativeJdbcExtractor.getNativeConnection(con);
} catch (SQLException e) {
throw new NonTransientDataAccessResourceException(
"Error unwrapping the Oracle Connection: " + e.getMessage(), e);

            }

chrisjschultz@c9b9694

I forked and added the above commit. It isn't 100% correct (I need to review close semantics, but basically implemented both as different decorators.

JdbcRetryPolicy

Hi,

I've started using the code for oracle rac support a month ago. Seems to be ok, I've only bumped into one issue... with JdbcRetryPolicy. The way exceptions are handled... some of them slipped through. I made a patch to it, wouldn't mind submitting it for review, if you're interested.

I've also updated RacFailoverRetryPolicy with another common code I've encountered during testing (17410).

Oh yeah, also wouldn't hurt actually posting the xsd online, http://www.springframework.org/schema/data-orcl/spring-data-orcl-1.0.xsd , for now I use the .com one http://www.springsource.com/schema/orcl/ap-oracle-db-1.0.xsd .

Thanks.
Z.

Add support for ResultTransformer to QueryDslJdbcTemplate

If you add a method like below, this will allow transforming result.

  public <V> V query(final SQLQuery sqlQuery, final ResultTransformer<V> transformer) {
    V results = jdbcTemplate.execute(new ConnectionCallback<V>() {
        public V doInConnection(Connection con) throws SQLException,
                DataAccessException {
            SQLQuery liveQuery = sqlQuery.clone(con);
            try {
                return liveQuery.transform(transformer);
            } catch (QueryException qe) {
                throw translateQueryException(qe, "SQLQuery", liveQuery.toString());
            }
        }});
    return results;
}

example use case

    QFxmatchProfiles qProfiles = QFxmatchProfiles.fxmatchProfiles;
    SQLQuery query = queryDslJdbcTemplate.newSqlQuery()
            .from(qProfiles)
            .where(qProfiles.profile.eq(profile));
    return queryDslJdbcTemplate.query(query, GroupBy.groupBy(qProfiles.menu).as(qProfiles));

This will return Map<String, FxmatchProfiles>, key as menu and value as item.

Spring Framework 5.0 Support?

Is this being dropped or is Spring Framework 5.0 support planned?

I noticed that the Contributing section has a link to a forum and JIRA that doesn't work.

Connection preparer is not working (over) the Proxy connection

"Custom DataSource Connection Preparer" doesn't work with the "Configuration of a Proxy Authentication", when oracle connection is set to a proxy connection all the session level information set by connection preparer is lost.
There should a way that connection preparer is invoked after (over) the Proxy connection, not before.

Multiple lines commit by producer --> Only one line receive by consumer

Hello,

I created a JMS Queue in my Oracle Database and a trigger on a table which call a procedure to enqueue messages.
When I insert/update/delete one row and then commit, my java app receive correctly the message, but when I commit multiple updates, my java app receive only the first message. But I can see on the Queue Table that my multiples messages had been inserted...

Can you tell me if you find an issue on my context file ?

<tx:annotation-driven/>

<context:annotation-config/>    
<context:property-placeholder location="classpath:META-INF/jdbc.properties" />  

<bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource">
    <property name="URL" value="${jdbc.url}" />
    <property name="user" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
</bean>

<bean id="messageDelegate" class="com.nagravision.itm.bpm.xml.MessageDelegate" />

<bean id="messageConverter" class="org.springframework.data.jdbc.jms.support.converter.oracle.XmlMessageConverter">
    <constructor-arg>
        <bean class="org.springframework.data.jdbc.support.oracle.DocumentXmlTypeHandler"/>
    </constructor-arg>
</bean>

<jms:listener-container connection-factory="connectionFactory" 
        transaction-manager="transactionManager" destination-type="topic" container-class="org.springframework.data.jdbc.jms.listener.oracle.XmlMessageListenerContainer" message-converter="messageConverter">
    <jms:listener destination="hr.it_data_queue" 
            ref="messageDelegate" method="handleMessage" />
</jms:listener-container>

<orcl:aq-jms-connection-factory id="connectionFactory" 
        data-source="dataSource" connection-factory-type="TOPIC_CONNECTION" />

<bean id="transactionManager"
      class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"/>
</bean>

Thanks in advance!
Regards,
François

Unable to perform durable topic subscription via AdtMessageListenerContainer

Hi,
I was trying to get a durable topic subscription using AdtMessageListenerContainer, but apparently it ignores setSubscriptionDurable() and setPubSubDomain() completely. This was my attempt:

@Bean
public AdtMessageListenerContainer jmsListenerContainer() throws JMSException {

	AdtMessageListenerContainer c =
		new AdtMessageListenerContainer();

	c.setSubscriptionDurable(true);
	c.setPubSubDomain(true);
	c.setSubscriptionShared(false);
	c.setClientId("CLIENT_ID");
	c.setDurableSubscriptionName("SUB_NAME");
	c.setDestinationName("TOPIC_NAME");
	c.setSessionTransacted(false);
	c.setTransactionManager(null);
	c.setMessageListener(new MyAQMessageListener());

	// The connection factory
	Properties info = new Properties();
	info.put("driver-name", "oracle.jdbc.OracleDriver");
	info.put("user", "user");
	info.put("password", "password");
	c.setConnectionFactory(
		oracle.jms.AQjmsFactory.getTopicConnectionFactory("jdbc:oracle:thin:@DB_NAME", info)
	);

	return c;
}

No matter what I try, the subscription is always named TSUB_1_* (with a variable id), and not "SUB_NAME".
Apparently, I fixed this by providing an alternative implementation which uses a createConsumer() method resembling that of AbstractMessageListenerContainer:

public class AQMessageListenerContainer extends DefaultMessageListenerContainer {

	@Override
	protected MessageConsumer createConsumer(Session session, Destination destination) throws JMSException {
		if (isPubSubDomain() && destination instanceof Topic) {
			if (isSubscriptionDurable()) {
				return ((AQjmsSession) session).createDurableSubscriber(
						(Topic) destination,
						getSubscriptionName(),
						getMessageSelector(),
						isPubSubNoLocal(),
						new OraDataFactory()
				);
			} else {
				return ((AQjmsSession) session).createSubscriber((Topic) destination);
			}
		} else {
			return ((AQjmsSession) session).createConsumer(
					destination,
					getMessageSelector(),
					new OraDataFactory(),
					null,
					isPubSubNoLocal());
		}
	}

	protected void doShutdown() throws JMSException {
		super.doShutdown();
		logger.info("Shut down complete.");
	}
}

Am I missing something or is AdtMessageListenerContainer really ignoring topic/subscription properties?

Connection leak in AqJmsFactoryBeanFactory

Hello,
I'm using org.springframework.data.jdbc.config.oracle.AqJmsFactoryBeanFactory without transaction synchronization. Unfortunately, when something goes wrong during execution of:

try {
    conToUse = nativeJdbcExtractor.getNativeConnection(con);              
} catch (SQLException e) {
    throw new NonTransientDataAccessResourceException(
            "Error unwrapping the Oracle Connection: " + e.getMessage(), e);            
}

for example:

Caused by: java.sql.SQLRecoverableException: Closed Connection
    at oracle.jdbc.driver.PhysicalConnection.getMetaData(PhysicalConnection.java:5216) [ojdbc7.jar:12.1.0.1.0]
    at org.jboss.jca.adapters.jdbc.WrappedConnection.getMetaData(WrappedConnection.java:841)
    at org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter.getNativeConnection(NativeJdbcExtractorAdapter.java:108) [spring-jdbc-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.data.jdbc.config.oracle.AqJmsFactoryBeanFactory$TransactionAwareDataSource.getConnection(AqJmsFactoryBeanFactory.java:134) [spring-data-oracle-1.2.1.RELEASE.jar:]
    ... 26 more

connection will be never released.

OneToManyResultSetExtractor cannot be reused unless you override "extractData".

OneToManyResultSetExtractor cannot be reused unless you override extractData.

On the first call to extractData, the results member is null and a new ArrayList is allocated. If the same instance of the extractor is reused in a subsequent query, it begins with results already holding the results of the prior query. Any new records returned by the query are now added to the existing results.

This is contrary to ResultSetExtractor Javadoc.

... a ResultSetExtractor object is typically stateless and thus reusable, as long as it doesn't access stateful resources (such as output streams when streaming LOB contents) or keep result state within the object

It should be reusable and results.clear() should be called to prevent returning previous results.

Change pool implementation to UCP from the recently deprecated ICC

With Oracle 11.2 the standard JDBC connection pool implementation has been deprecated in favor of the much smarter UCP implementation.
Where the original implementation was oracle.jdbc.pool.OracleDataSource it has been replace by oracle.ucp.jdbc.PoolDataSourceImpl.
This new class is packaged separately in a ucp.jar outside of the regular ojdbc.jar. This pool is significantly more intelligent with built in failover support for RAC clustering. Is there any chance we could move or alternatively just support this new pool implementation? From what I can see it mostly seems to revolve around using the correct factory implementation. here's a link I found:
https://stackoverflow.com/questions/1427890/oracledatasource-vs-oracle-ucp-pooldatasource

support for 3.x version of querydsl

Hi,

There are a few changes in querydsl (I found 1: querydsl/querydsl#186) that reqire changes in the spring-data-jdbc-ext package.

The above change causes QueryDslJdbcTemplate.newSqlQuery() to throw ClassNotFoundException.

Are those changes planed in the near future?

Thank you,
Vitaly

DefaultMessageListenerContainer with AqJmsFactoryBeanFactory ends up calling commit twice

Moved from: https://jira.spring.io/browse/DATAJDBC-94


Using a DefaultMessageListenerContainer with the attribute sessionTransacted set to 'true' and using a transactionManager ends up calling twice the method 'commi'. Once via the Transactional annotation support and a second time via org.springframework.jms.connection.ConnectionFactoryUtils.JmsResourceSynchronization.JmsResourceSynchronization which is registered as a TransactionSynchronization.

This synchronization is registered in the method org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession, and it implements the method afterCommit which eventually tries to invoke javax.jms.Session.commit().

Since the Session was created on top of the same connection as the one used by the TransactionManager, the TransactionManager will first perform its own commit on the connection and then the afterCommit of the TransactionSynchronization will itself also invoke commit on the JMS Session which delegates it eventually to underlying connection (but which is the same as the one used by the TransactionManager). This second is pointless and can even be quite dangerous because the underlying connection could be already released and re-used by another thread.

Background info where the issue happened:

  • Using EclipseLink (and JPATransactionManager)
  • Oracle JDBC driver v7
  • Orale advanced queuing (with org.springframework.data.jdbc.config.oracle.AqJmsFactoryBeanFactory)

The way I spotted this is that, Oracle JDBC driver v7 enforces the fact that you cannot call "commit" on a connection with autoCommit = true. EclipseLink automatically set the autoCommit flag back to true whenever committing a transaction. Therefore JPATransactionManager was calling commit and setting back the autoCommit flag to true, and then the second commit was always triggering an Exception in Oracle driver.

Support for 4.x querydsl

Hi!
Could you, please, add a support for querydsl 4.x? In the new version of that framework all packaging structure has been changed, therefore it is not possible to use jdbc-extensions with a 4.x version of querydsl.

Warm Regards,
Tomasz Cudek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.