You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How would one override the predefined automatically incrementing integer primary key?
In my case, I'd like to use a UUID and I don't need an integer primary key at all.
That fails with: cannot override getId() in com.craftmend.storm.api.StormModel.
I'm thinking the id could be optional by having a base model (without id) and a default model (with id). I could use the base model for models with custom primary keys.
The text was updated successfully, but these errors were encountered:
This is definitely worth looking into, though I don't think that #9 is a clean way to go about it because it doesn't force certain implementation traits (like the default getter, type coercion, or presence).
I'll take a look at this concept later this weekend, specifically using class type parameters to define a specific key type, whilst still providing the base getter. This would make it accessible through normal calls and doesn't require additional reflection to access (what should be) a generic field.
There are also some additional issues with the current implementation, mostly concerning serialization. IMO Storm should force a dedicated type adapter to be present for any given value, to ensure that it gets drilled won to its minimum SQL definition (and provide a character limit/encoding type that best fits the boxed type). Otherwise, nothing would be stopping you from using a BigInt as a primary key, which would resolve to a text/varchar instead of a numeric type. Due to this, and a few other reasons (like upstream API changes from return types, due to no other reason than personal preference), the PR will unfortunately not be merged.
How would one override the predefined automatically incrementing integer primary key?
In my case, I'd like to use a UUID and I don't need an integer primary key at all.
Example:
That fails with:
cannot override getId() in com.craftmend.storm.api.StormModel
.I'm thinking the id could be optional by having a base model (without id) and a default model (with id). I could use the base model for models with custom primary keys.
The text was updated successfully, but these errors were encountered: