Hi,
We purchased your HXTT Text and it works very well, thanks.
My DBA asked me to get "1" for "true" and "0" for "false". Can I change it?
I tried to change the "open source" dialect :
public abstract class HxttDialect extends Dialect
public final String toBooleanValueString(final boolean bool) {
// *WAS* return bool ? "true" : "false";
return bool ? "1" : "0";
}
(this method is not overridden in the class HxttTextDialect which is the one I use to generate my data through Hibernate)
But I always get "true" or "false" in my files...
Have you got an idea?
Thank you in advance
G. Dubois
|
I guess toBooleanValueString should be used for sql generation in Hibernate. If you wish to get 1, and 0, you can use ResultSet.getInt(), not ResultSet.getBoolean() method to fetch data.
|
Hello,
Maybe I wasn't clear : I talked about the data that is written in the CSV file. I need to get 0 or 1, but I always get "true" or "false".
I never read the data, I only write it to through HXTT in the CSV files. Afterwards, the generated (random) data that is in the CSV files is read by a DB script to inject the data in Oracle.
Can you help me get the right values written in the CSV files?
Many thanks
G. Dubois
|
You can define that boolean column as int column through CREATE TABLE sql, then all true/false value will be written as 1 and 0.
|
Thank you for your answer.
Unfortunately, I never use CREATE TABLE sql... I generate blank CSV files and their header on-the-fly using Hibernate's mappings. So I don't have to worry about DB changes as long as these are mapped in Hibernate.
Isn't there a way to always have booleans as int values?
Well, I think I will try through Hibernate mapping and I tell you if this is OK ;o)
|
If your data contains only 1 and 0, HXTT Text will think it's an int type.
|
Hello,
It's me again ;o)
Well, for the booleans I'll find a way...
But I have a strange behaviour :
I have fields mapped as String, where I put codes (e.g. : "00001" or "01"). It works for some records and then the zero's are trimmed(!!!). As some are foreign keys, it it a huge and super-urgent problem!
Any idea?
Appearently, it happens on all varchar columns at once
e.g. (2 records inserted; last and before-last coloms should contain zero's as on first record shown; separator is semi-colon):
203;90;305;1995-12-03 07:45:13.049;1995-12-03 07:45:13.049;;3;01;204;25;01;0009
212;91;316;1993-02-10 12:08:21;1998-12-13 04:16:14;;20;1;;25;1;6
Added : appearently the dates are also shortened!!!
I also tried with separator comma, but it is the same.
This is a huge bug (I insert records through Hibernate, so I never change the data pamming nor the way it is recorded).
I need to get the code working by tomorrow.
Can you help me?
Thank you
|
maxScanRows: Indicates how many rows should be scanned when determining the column types. If you set maxScanRows to 0, the entire file is scanned. If you set maxScanRows to a negative value, the file won't be scanned. For those tables with predefined table structure, that option will be ignored.
You can try maxScanRows=-1 connection property.
|
It is exactly what I needed...
Many thanks for your quick answers!
|