Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ private void generateSave(ClassCreator classCreator, FieldDescriptor entityClass
BytecodeCreator idValueUnset;
BytecodeCreator idValueSet;
if (idType instanceof PrimitiveType) {
if (!idType.name().equals(DotNames.PRIMITIVE_LONG)
&& !idType.name().equals(DotNames.PRIMITIVE_INTEGER)) {
throw new IllegalArgumentException("Id type of '" + entityDotName + "' is invalid.");
}
if (idType.name().equals(DotNames.PRIMITIVE_LONG)) {
idValue = save.checkCast(idValue, int.class);
}
BranchResult idValueNonZeroBranch = save.ifNonZero(idValue);
idValueSet = idValueNonZeroBranch.trueBranch();
idValueUnset = idValueNonZeroBranch.falseBranch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Entity
public class Book extends NamedEntity {

private Integer bid;
private int bid;

private Integer publicationYear;

Expand All @@ -20,11 +20,11 @@ public Book(Integer bid, String name, Integer publicationYear) {
}

@Id
public Integer getBid() {
public int getBid() {
return bid;
}

public void setBid(Integer bid) {
public void setBid(int bid) {
this.bid = bid;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Cat {

@Id
@GeneratedValue
public Long id;
public long id;

private String breed;

Expand All @@ -25,7 +25,7 @@ public Cat(String breed, String color) {
this.color = color;
}

public Long getId() {
public long getId() {
return id;
}

Expand Down