mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#3268 - @DbComment on @ManyToOne fields are ignored (ddl-generator)
This commit is contained in:
@@ -99,6 +99,10 @@ final class AnnotationFields extends AnnotationParser {
|
||||
if (formula != null) {
|
||||
prop.setSqlFormula(processFormula(formula.select()), processFormula(formula.join()));
|
||||
}
|
||||
DbComment comment = get(prop, DbComment.class);
|
||||
if (comment != null) {
|
||||
prop.setDbComment(comment.value());
|
||||
}
|
||||
initWhoProperties(prop);
|
||||
initDbMigration(prop);
|
||||
}
|
||||
|
||||
+1
@@ -203,6 +203,7 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
|
||||
MColumn col = table.addColumn(dbCol, columnDefn, !p.isNullable());
|
||||
col.setDbMigrationInfos(p.dbMigrationInfos());
|
||||
col.setDefaultValue(p.dbColumnDefault());
|
||||
col.setComment(p.dbComment());
|
||||
if (addForeignKey) {
|
||||
if (columns.length > 1) {
|
||||
compoundKey.addColumnPair(dbCol, refColumn);
|
||||
|
||||
+8
@@ -49,6 +49,7 @@ public class ModelBuildBeanVisitorTest extends BaseTestCase {
|
||||
assert_discriminatorColumn_explicit(model);
|
||||
assert_discriminatorColumn_implied(model);
|
||||
assert_discriminatorColumn_length(model);
|
||||
assert_comment_onManyToOne(model);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -144,4 +145,11 @@ public class ModelBuildBeanVisitorTest extends BaseTestCase {
|
||||
assertThat(discTypeColumn.getType()).isEqualTo("varchar(3)");
|
||||
assertThat(discTypeColumn.isNotnull()).isTrue();
|
||||
}
|
||||
|
||||
private void assert_comment_onManyToOne(ModelContainer model) {
|
||||
MTable message = model.getTable("c_message");
|
||||
MColumn conversation = message.getColumn("conversation_id");
|
||||
assertThat(conversation.getType()).isEqualTo("bigint");
|
||||
assertThat(conversation.getComment()).isEqualTo("A ManyToOne comment");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.tests.model.converstation;
|
||||
|
||||
import io.ebean.annotation.DbComment;
|
||||
import org.tests.model.BaseModel;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
@@ -14,6 +15,7 @@ public class Message extends BaseModel {
|
||||
|
||||
String body;
|
||||
|
||||
@DbComment("A ManyToOne comment")
|
||||
@ManyToOne
|
||||
Conversation conversation;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user