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

The column name 'true' is not valid #890

Closed
yeradis opened this issue Aug 11, 2014 · 7 comments
Closed

The column name 'true' is not valid #890

yeradis opened this issue Aug 11, 2014 · 7 comments
Labels
bug
Milestone

Comments

@yeradis
Copy link

@yeradis yeradis commented Aug 11, 2014

I was trying to filter a column which type is BIT (i'm using SQLServer)
Something like this:

mapeos.activo.isTrue()

or :

mapeos.activo.eq(true)

raise an sql exception:

The column name 'true' is not valid

the generated SQL is:

and IDS_MAPEOS.ACTIVO = true

and should be :

and IDS_MAPEOS.ACTIVO = 'true'

or

and IDS_MAPEOS.ACTIVO = 1
@timowest
Copy link
Member

@timowest timowest commented Aug 11, 2014

Do you have the literal serialization enabled?

@yeradis
Copy link
Author

@yeradis yeradis commented Aug 11, 2014

Sorry the delay
This is my config:

<plugin>
                <groupId>com.mysema.querydsl</groupId>
                <artifactId>querydsl-maven-plugin</artifactId>
                <version>${querydsl.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>export</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jdbcDriver>net.sourceforge.jtds.jdbc.Driver</jdbcDriver>
                    <jdbcUrl>jdbc:jtds:sqlserver://xxxxxxxxxxx</jdbcUrl>
                    <jdbcUser>xxxxx</jdbcUser>
                    <jdbcPassword>xxxxxxx</jdbcPassword>
                    <packageName>com.sql.model.querydsl</packageName>
                    <targetFolder>${project.basedir}/target/generated-sources/java</targetFolder>
                    <exportBeans>true</exportBeans>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>net.sourceforge.jtds</groupId>
                        <artifactId>jtds</artifactId>
                        <version>${jtds.version}</version>
                    </dependency>
                </dependencies>
 </plugin>

The literal serialization should be enabled?

@timowest
Copy link
Member

@timowest timowest commented Aug 11, 2014

I am asking because the error looks like that. How does your serialized query look like? The one that Querydsl provides to JDBC.

@yeradis
Copy link
Author

@yeradis yeradis commented Aug 12, 2014

Hello

from(QIdsHotel.idsHotel).
                where(QIdsHotel.idsHotel.activo.isTrue(),
                        QIdsHotel.idsHotel.codsubcanal.eq(getContext().getSubChannel()))
                .list(QIdsHotel.idsHotel);

the "from" is:

protected SQLQuery from(Expression<?> expression) {
        return query().from(expression);
}

This is the generate query:

select IDS_HOTEL.CODIGOHOT, IDS_HOTEL.ETP, IDS_HOTEL.PASSWORD, IDS_HOTEL.CODSUBCANAL, IDS_HOTEL.TIPO_PRECIO, IDS_HOTEL.LAST_REQUEST, IDS_HOTEL.CODIGOHOT_EXT, IDS_HOTEL.USUARIO, IDS_HOTEL.ACTIVO
from dbo.IDS_HOTEL IDS_HOTEL
where IDS_HOTEL.ACTIVO = true and IDS_HOTEL.CODSUBCANAL = 'CECI'
@timowest timowest added the bug label Aug 12, 2014
@timowest
Copy link
Member

@timowest timowest commented Aug 14, 2014

There should be questions marks for true and 'CECI'. Are you sure this query is generated by Querydsl?

@timowest timowest added this to the 3.4.3 milestone Aug 14, 2014
@timowest
Copy link
Member

@timowest timowest commented Aug 14, 2014

I added now a pull request, but it fixes the Querydsl behaviour only for cases where you have literal serialization on, by default prepared statement bindings are used though.

For prepared statement bindings booleans work in any case.

@timowest
Copy link
Member

@timowest timowest commented Aug 31, 2014

Released in 3.4.3

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.