android


OrmLite where clause and SQL between with java.util.date


I try to create a query with a where clause which filters between dates. My query looks something like
java.util.Date date1 = ...
java.util.Date date2 = ...
where().between("datefield", date1, date2)
But it doesn't work. I am building my query with the QueryBuilder and I use selectRaw(...) and queryRaw(...). Can anyone help?
Yeah, this isn't going to work because under Android, Date fields are being persisted as strings which don't compare right when using SQL between. One way to fix this would be to store your Date fields as longs instead:
#DatabaseField(dataType = DataType.DATE_LONG)
private Date dateField;
This will store the Date as the epoch milliseconds long number which is comparable and which will work with between.

Related Links

BroadcastReceiver keep getting data when unregisterd
Contact Android App via USB
Save image from ImageView to device gallery
Dynamically Created Radio Button or CheckBox does not use Color Accent
Debug instrumentation test
How to Implement Swipe In Android Game Without View
android-display multiple images and to next line if no enough room
How to draw a rect in the middle of screen-Android development
Native Android app crashes with SIGILL on x86
Switching to Landscape is not switching to correct XML
Lowest OpenGL ES version to use Vertex Buffer Objects
onSensorChanged() not calling for Gyroscope Sensor
Phonegap run android gives error
GCM is not working on Android Virtual Device: java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
how do i create the database in my android app?
EditText with “text” inputType not hiding error popup when text is changed

Categories

HOME
fuelux
merge
depth
numbers
themes
components
composite-primary-key
replace
access
bitbucket-api
cakephp-3.4
zip
echo
qpython
arangodb
32bit-64bit
emoji
spring-social
gkturnbasedmatch
google-content-api
git-extensions
jmp
database-connection
rubymotion
springfox
inno-download-plugin
interpreter
resourcebundle
tiki-wiki
maze
ms-access-web-app
uitapgesturerecognizer
google-cast
clickjacking
sharding
sql-delete
batching
protege4
tex
protein-database
recurrent-neural-network
metaprogramming
typesafe-config
unordered-map
apache-stanbol
naming
print-css
tcc
google-cse
oracleclient
backbone-collections
opengl-4
monkey
cmp
universal-analytics
gameplay-kit
reachability
change-tracking
ng-grid
simevents
freepbx
php-socket
phpwebsocket
uiactionsheet
spring-retry
custom-errors
assertion
avisynth
sha512
shopizer
document-repository
nodelist
filesplitting
pseudo-class
trdion2011
mdichild
with-statement
template-deduction
ss7
parallel-testing
openargs
scriptaculous
mysql-error-1044
kendo-dataviz
breakout
hidapi
node-blade
css-reset
octal
font-awesome-4.0.0
onload-event
tree-balancing
sentestingkit
garbage
w3c-geolocation
massive
presentation-layer
eclipse-marketplace
blender-2.49
request-headers
skype4java
sun
asynchronous-wcf-call
perl5.12

Resources

Encrypt Message