-
Notifications
You must be signed in to change notification settings - Fork 303
Closed
Milestone
Description
Issue Basics
- ObjectBox version - 2.0.0
- Reproducibility: Happens everytime
I've come across an issue when I tried to use setAndPutTarget. Originally I was trying to use just setTarget but realized that the target was not beeing put into a box. This meant later when I tried to get the Target it would return null even though I had the correct id.
When I tried using setAndPutTarget I would get a failure because "ensureBoxes" method in the ToOne.java file would return a null object for boxstore on line 114.
To solve my issue, I had to put the object into the correct box and then call setTarget.
That works well enough, but it seems like there might be a bug I came across.
Here is my entity class
@Entity
public class InventoryItem {
@Id(assignable = true)
private long id;
private String itemId;
private String barcode;
private String alias;
private String alias2;
private String description;
public ToOne<Category1> category1;
public ToOne<Category2> category2;
public ToOne<Category3> category3;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal price1;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal price2;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal price3;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal price4;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal price5;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal price6;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal price7;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal price8;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal price9;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal price10;
private double quantityOnHand;
@Convert(converter = BigDecimalConverter.class, dbType = String.class)
private BigDecimal cost;
private Boolean isNonStock;
private Boolean isWICItem;
private Boolean isFoodStampable;
private Boolean isShoppingCartItem;
private String taxStatus;
private String mixMatchName;
private double packageCount;
private String packageSize;
private long linkedItemPersistentId;
private String linkedItemName;
public ToOne<Vendor> vendor1;
public long vendorId1;
public ToOne<Vendor> vendor2;
public long vendorId2;
private double orderMultipleQuantity;
private double maximumQOH;
private double minimumQOH;
private Date lastPurchaseDate;
private Date lastSaleDate;
public InventoryItem() {
itemId = "";
barcode = "";
alias = "";
alias2 = "";
description = "";
isFoodStampable = false;
isWICItem = false;
taxStatus = "N";
mixMatchName = "";
price1 = BigDecimal.ZERO;
price2 = BigDecimal.ZERO;
price3 = BigDecimal.ZERO;
price4 = BigDecimal.ZERO;
price5 = BigDecimal.ZERO;
price6 = BigDecimal.ZERO;
price7 = BigDecimal.ZERO;
price8 = BigDecimal.ZERO;
price9 = BigDecimal.ZERO;
price10 = BigDecimal.ZERO;
quantityOnHand = 0.0;
cost = BigDecimal.ZERO;
isNonStock = false;
isWICItem = false;
isFoodStampable = false;
isShoppingCartItem = true;
vendorId1 = 0;
vendorId2 = 0;
orderMultipleQuantity = 0.0;
maximumQOH = 0.0;
minimumQOH = 0.0;
lastPurchaseDate = new Date();
lastSaleDate = new Date();
packageCount = 0;
packageSize = "";
linkedItemPersistentId = 0;
linkedItemName = "";
}
@Entity
public class Vendor implements Parcelable, Serializable {
@Id(assignable = true)
public long id;
public String name;
public Vendor () {
this.id = 0;
this.name = "";
}
@Override
public String toString()
{
return "Vendor: " + id + " - " + name;
}
@Override
public int describeContents()
{
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags)
{
dest.writeLong(this.id);
dest.writeString(this.name);
}
protected Vendor(Parcel in)
{
this.id = in.readLong();
this.name = in.readString();
}
public static final Creator<Vendor> CREATOR = new Creator<Vendor>()
{
@Override
public Vendor createFromParcel(Parcel source)
{
return new Vendor(source);
}
@Override
public Vendor[] newArray(int size)
{
return new Vendor[size];
}
};
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels