litesuits / litesuits/android-lite-orm

无法插入级联数据

Open
#26 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.5k
Forks
359
PR merge metrics
No merged PRs in 30d

Description

@Table("tb_user")
public class UserModel extends BaseModel {
private static final long serialVersionUID = 1L;

public static final String COL_MOBILE = "mobile";

@NotNull
@Column(COL_MOBILE)
private String mobile;

@Mapping(Relation.OneToMany)
private ArrayList roles;
}

@Table("tb_role")
public class RoleModel extends BaseModel {

@Unique
@NotNull
private int roleId;

private String role;

}

public void insert(T t) {
getLiteOrm().cascade().insert(t, ConflictAlgorithm.Abort);
}
插入数据userMode,UserModel中其他字段都可以插入,唯独roles是空

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the public insert(T t) entry point and trace getLiteOrm().cascade().insert with the UserModel.roles mapping. Compare how UserModel and RoleModel are processed, then verify that the roles data is persisted along with the user and that the existing non-role fields still insert correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.