Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not get array type of PostgreSQL through QueryDslJdbcTemplate/Spring-Data #484

Closed
nabedge opened this issue Aug 26, 2013 · 3 comments
Closed
Labels
Milestone

Comments

@nabedge
Copy link

@nabedge nabedge commented Aug 26, 2013

I would like to access the array type column on postgresql through QueryDslJdbcTemplate and spring-data .

TABLE DDL and DML:

  create schema qdslsampleuser;
  create table mytable (
      id bigint primary key
      ,myarray varchar(8)[]
  );
  insert into mytable (id, myarray) values (1, array['a','b','c']);

The code:

  @RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = { "classpath:applicationContext.xml" })

  public class SimpleTest {

    private static Logger logger = LogManager.getLogger();

    @Autowired
    private QueryDslJdbcTemplate qdslTemplate;

    @Test
    public void queryDslSample01() {
        logger.info("******** queryDslSample01 START ********");
        SQLQuery query = qdslTemplate.newSqlQuery();

        QMytable qMytable = QMytable.mytable;
        query.from(qMytable).where(qMytable.id.eq(Long.parseLong("1")));
        Mytable mytable = qdslTemplate.queryForObject(query, qMytable);

        // SQL statement will be executed.
        // But I can not get the resultSet as Mytable instance !
        logger.info("******** queryDslSample01 END {}", mytable.getMyarray()

                .toString());
    }

This test will fail.
How to do that ?

All the sample code is on github.com

  1. install postgresql9.x on localhost
  2. git clone https://github.com/nabedge/qdsl-springdata-sample.git
  3. mvn clean test (including querydsl metaclass generation)
timowest added a commit that referenced this issue Aug 26, 2013
@nabedge
Copy link
Author

@nabedge nabedge commented Aug 27, 2013

Thank you Timo.
Would you tell me about is this bug or not ?
Should I version up to 3.x from 2.9.0.FIXED ?
But I can not use new one because I 'm using spring-data-jdbc-core that depends on 2.9.x .

Are there any work-arround ?

@timowest
Copy link
Member

@timowest timowest commented Aug 27, 2013

Using JDBC arrays is not yet supported.

@timowest timowest added this to the 3.5.0 milestone Aug 31, 2014
@timowest
Copy link
Member

@timowest timowest commented Sep 30, 2014

Released in 3.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.