Comments (6)
Ok, I have a feeling I know the problem.
Ebean's "ScalarTypes" are expected to be immutable (like the Joda types
etc) so for a update Ebean is expecting a new instance of SimpleStringProperty
to be set.
I suspect that instead a new string value is set to the SimpleStringProperty
instance (so ebean isn't detecting a changed value).
Hmm, do you have a unit test or main method that you are using to test - I
didn't see one in your project.
On 16 January 2014 20:57, nonameplum [email protected] wrote:
Hi,
At the beginning - It is really hard to find some documentation how to
convert some database types to custom classes.I'm trying to create javaFX8 bean (observable properties) to work with
Ebean.
So bean looks like this:@entity
@table(name="something")
public class Something {
@id
private SimpleIntegerProperty id;
private SimpleStringProperty name;public int getId() { return id.get(); } public SimpleIntegerProperty idProperty() { return id; } public void setId(int id) { this.id.set(id); } public String getName() { return name.get(); } public SimpleStringProperty nameProperty() { return name; } public void setName(String name) { this.name.set(name); }
}
I have created to ScalarTypeConverter classes like this:
public class SimpleIntegerPropertyConverter implements ScalarTypeConverter<SimpleIntegerProperty, Integer> {
@OverRide
public SimpleIntegerProperty getNullValue() {
return null;
}@Override public SimpleIntegerProperty wrapValue(Integer integer) { return new SimpleIntegerProperty(integer); } @Override public Integer unwrapValue(SimpleIntegerProperty simpleIntegerProperty) { return simpleIntegerProperty.getValue(); }
}
public class SimpleStringPropertyConverter implements ScalarTypeConverter<SimpleStringProperty, String> {
@OverRide
public SimpleStringProperty getNullValue() {
return null;
}@Override public SimpleStringProperty wrapValue(String s) { return new SimpleStringProperty(s); } @Override public String unwrapValue(SimpleStringProperty simpleStringProperty) { return simpleStringProperty.getValue(); }
}
This works when I'm reading from database. But save, update is not
working. I found that old values is always null. Maybe I'm doing something
wrong or this is bug?You can find maven project on github where I'm testing that
https://github.com/nonameplum/appFx—
Reply to this email directly or view it on GitHubhttps://github.com//issues/69
.
from ebean.
If this working that way you have right - Ebean will not detect changes.
I wrote simple code to test Ebean update
You can find it now here: https://github.com/nonameplum/appFx/blob/master/src/main/java/appFx/controllers/TestController.java
In method makeEbeanTest. In comments you can see what happen when code is run.
from ebean.
Yes, that isn't going to work in that Ebean isn't going to detect changed
values etc.
Hmm, it might work on the next release though. I'm changing the enhancement
and the way update works. Assuming you don't care about 'partial objects /
partially loaded beans' (all the properties on your beans are considered
loaded).
On 17 January 2014 00:47, nonameplum [email protected] wrote:
If this working that way you have right - Ebean will not detect changes.
I wrote simple code to test Ebean update
You can find it now here:
https://github.com/nonameplum/appFx/blob/master/src/main/java/appFx/controllers/TestController.javaIn method makeEbeanTest. In comments you can see what happen when code is
run.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/69#issuecomment-32462284
.
from ebean.
Thanks for your interest. For now only solution that I found to force update is make this:
Ebean.update(something, new HashSet<String>(Arrays.asList("id", "name")));
I don't see this in Ebean class as public, but you can consider to add methods like:
Ebean.forceUpdate(..);
from ebean.
Yes, I don't see a problem with something like forceUpdate(...);
The next major release (release 4.x) has a large refactor of the update internals (insert, update, delete actually). I put that on hold as I need to get another 3.x release out which I'm working on right now. The 3.x release is pretty close now (maybe 1 week) so I'll get that out and look at release 4.x again.
Ideally I don't look at a forceUpdate() method until the 4.x is underway again.
from ebean.
This should be fixed in 4.0.1-RC1 (current master). The stateless update feature has been re-written. Note that 4.x has new enhancement (agent and mavenenhancer version 4.1.0 should be used - these have just been released to maven central).
Ebean version 4.0.1-RC1 will be released very shortly (days).
I'll close this for now. Let me know how you go when you get to try/use v4.x. Thanks, Rob.
from ebean.
Related Issues (20)
- Question: Reason for transaction not being reused? HOT 10
- LimitOffsetPagedList add getTotalCount cache HOT 1
- After packaging Javalin + Ebean into a JAR file, it cannot run:jakarta.persistence.PersistenceException: hxy.dragon.model.Customer is NOT an Entity Bean registered with this server HOT 2
- Feature request: add query bean copy() method to TQRootBean interface HOT 2
- Empty OneToMany when overflowing LazyLoadBatchSize and mixed queries HOT 11
- IntelliJ IDEA 2024.1 needs updated plugin HOT 1
- ebean-gradle-plugin: ERROR [Test worker] io.ebean.internal::Error in deployment / Error trying to create the prototypeEntityBean for class HOT 14
- [12.16.3] Add support for "NoTimeZone", specifically to use no timeZone with MySql
- How to delete permanently use Qbean when use SoftDelete HOT 3
- ddl-generator: Identity for PK is always generated HOT 5
- Ebean-Data (auto generated repositories)? HOT 1
- querybean-generator incremental annotation processing not working in gradle HOT 8
- ReadOnly transactions does not honor isolation-level HOT 1
- Race condition EBean 14 HOT 7
- Q: is there a way to invalidate lazy-loaded entity bean field? HOT 17
- Sorting on a ManyToMany relationship HOT 1
- No delay on SIGTERM before shutting down future count ThreadPoolExecutor HOT 2
- Unable to use kapt to generate querybean in Maven HOT 1
- JtraTransactionManager keeps reference to already closed scope (and Transaction/connection ThreadLocal) when JtaTxnListener#afterCompletion is called by a different thread HOT 3
- 12.8.3 java.util.ConcurrentModificationException: null HOT 7
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 ebean.