|
59 | 59 | * Support create additional tables from a model.<br> |
60 | 60 | * <p> |
61 | 61 | * Notice: |
| 62 | + * <ul> |
62 | 63 | * <li>This feature only support `Record` type. |
63 | 64 | * <li>An additional table only supports one list-type field. |
64 | 65 | * <li>Create `MultiColumnsIndex` on the additional table only when it contains all need columns. |
| 66 | + * </ul> |
65 | 67 | * <p> |
66 | 68 | * The typical use is: when need to storage a `List` field, we can transform it to another table as row set.<br> |
67 | 69 | * For example in SegmentRecord#tags create an additional table: |
68 | | - * <pre>{@code |
69 | | - * @SQLDatabase.AdditionalEntity(additionalTables = {ADDITIONAL_TAG_TABLE}) |
70 | | - * private List<String> tags;}</pre> |
| 70 | + * <pre> |
| 71 | + * {@code @SQLDatabase.AdditionalEntity(additionalTables = {ADDITIONAL_TAG_TABLE})} |
| 72 | + * {@code private List<String> tags;} |
| 73 | + * </pre> |
71 | 74 | * <p> |
72 | 75 | * In H2TraceQueryDAO#queryBasicTraces query tags as condition from this additional table, could build sql like this: |
73 | 76 | * <pre>{@code |
|
95 | 98 | * } |
96 | 99 | * }</pre> |
97 | 100 | * <p> |
| 101 | + * <ul> |
98 | 102 | * <li>If no tags condition, only query segment table, the SQL should be: select |
99 | 103 | * column1, column2 ... from segment where 1=1 and colunm1=xx ... |
100 | 104 | * |
101 | | - *<li> If 1 tag condition, query both segment and segment_tag tables, the SQL should be: select column1, column2 ... |
| 105 | + * <li> If 1 tag condition, query both segment and segment_tag tables, the SQL should be: select column1, column2 ... |
102 | 106 | * from segment inner join segment_tag segment_tag0 on segment.id=segment_tag0.id where 1=1 and colunm1=xx ... and |
103 | 107 | * segment_tag0=tagString0 |
104 | 108 | * |
105 | | - *<li> If 2 or more tags condition, query both segment and segment_tag tables, the SQL should be: select column1, |
| 109 | + * <li> If 2 or more tags condition, query both segment and segment_tag tables, the SQL should be: select column1, |
106 | 110 | * column2 ... from segment inner join segment_tag segment_tag0 on segment.id=segment_tag0.id inner join segment_tag |
107 | 111 | * segment_tag1 on segment.id=segment_tag1.id ... where 1=1 and colunm1=xx ... and segment_tag0=tagString0 and |
108 | 112 | * segment_tag1=tagString1 ... |
109 | | - * |
| 113 | + * </ul> |
110 | 114 | */ |
111 | 115 | @Target({ElementType.FIELD}) |
112 | 116 | @Retention(RetentionPolicy.RUNTIME) |
|
0 commit comments