Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null nested models are instantiated (with null fields). #301

Closed
PtiPingouin opened this issue Oct 11, 2016 · 7 comments
Closed

Null nested models are instantiated (with null fields). #301

PtiPingouin opened this issue Oct 11, 2016 · 7 comments

Comments

@PtiPingouin
Copy link

PtiPingouin commented Oct 11, 2016

Consider the following code, where Model2 is also a table:

@Table
public class Model1 {
    @Nullable
    protected Model2 model2;
}

When reading from database an instance of Model1 that has no model2, model1 still gets a model2 instance, with null values.

In Model1_Schema, I can see there are no condition for instantiating model2:

  @NonNull
  @Override
  public Model1 newModelFromCursor(@NonNull OrmaConnection conn, @NonNull Cursor cursor, int offset) {
    Model1 model = new Model1();
    model.setModel2(Model2_Schema.INSTANCE.newModelFromCursor(...));
    return model;
  }

Model2_Schema.INSTANCE.newModelFromCursor() is called no matter what.

Am I missing something?

@gfx
Copy link
Member

gfx commented Oct 11, 2016

What's your Orma version?

@PtiPingouin
Copy link
Author

3.0.0-rc3

@gfx
Copy link
Member

gfx commented Oct 11, 2016

Seems bugs. Will investigate it.

@PtiPingouin
Copy link
Author

Thanks

@gfx
Copy link
Member

gfx commented Oct 11, 2016

NOTE: This issue should be fixed in #263 but the PR didn't solve it.

@gfx
Copy link
Member

gfx commented Oct 11, 2016

Released v3.0.0-rc4 with this bug fix. Can you try it please?

@PtiPingouin
Copy link
Author

Ok

On Tue, Oct 11, 2016 at 4:40 PM, FUJI Goro [email protected] wrote:

Released v3.0.0-rc4 with this bug fix. Can you try it please?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#301 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA2BLMqwRbKNos9XPN9cwYLqqGX-2rEMks5qy5_DgaJpZM4KTdWC
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants