Comments (3)
New to simeplejpa and seeing the same thing. Would love some pointers on best practices to serialize/deserialize these fields.
from simplejpa.
SimpleJPA was probably made before SimpleDBUtils was available and I believe the encoding we used was common practice to ensure it was padded properly and sortable. For example: http://aws.amazon.com/articles/1232
Happy to take pull requests though if you want to make it configurable.
from simplejpa.
Inspecting the Hibernate type mapping support would be a good start. Hibernate has a default strategy to map types to the underlying Dialect. There is a default strategy for type mapping and if specified otherwise a custom one.
Them main reason for needing the choice is SimpleDB stores everything as text and hence for searching and ordering, one will need to convert the types into lexical formats that will allow proper ordering.
E.g. for integer values we could calculate an offset (as currently done by the simplejpa entitymanager) that is lexically sortable.
// default strategy @Type(type = "org.spaceprogram.simpejpa.IntegerOffsetType")
@Column(name = "some_int_field")
private int someIntegerField;
Input: 2
Result: 09223372036854775810
Then we could create other type mapping strategies for the integer like below:
@Type(type = "org.spaceprogram.simpejpa.IntegerPaddedType")
@Column(name = "some_int_field")
private int someIntegerField;
Input: 2
Result: 0000000000000000002
Internalized dates is another area where this could be beneficial. E.g if we have dates with timezone offset we need to convert them all to UTC times to be properly sortable. Or sometimes they need to be local, as in show me all flights that depart prior to 6:00am at airport local time across the US.
from simplejpa.
Related Issues (20)
- junit tests fail HOT 5
- Proxy support HOT 2
- Cascade support?
- @Enumerated doesn't work on fields
- Builds with Maven HOT 5
- Using 'order by' gives InvalidSortExpression HOT 1
- replaceClassName behaviour
- Not equals query error HOT 2
- Wrong value in numeric fields HOT 1
- Respect Remove Cascade setting on OneToMany Relationship
- EntityTransactionImpl implementation
- Queries with keyword 'IN'
- @GeneratedValue
- Any plans to migrate this to (latest) AWS SDK (for JAVA) 1.3.11
- LazyList and Collections.sort() and Collections.reverse() behavior HOT 2
- Please, add a LICENSE HOT 1
- Add CriteriaBuilder support. HOT 1
- Unable to find javax.mail:mail:jar:1.4.5-SNAPSHOT HOT 2
- Is simplejpa certified to run on AWS 1.2.6? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simplejpa.