Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.springframework.data.relational.core.mapping '@Table' name property #72

Closed
kimdg1105 opened this issue Nov 7, 2022 · 4 comments
Closed

Comments

@kimdg1105
Copy link

Hi. I use spring data jdbc and 'infobip-spring-data-querydsl:7.2.0' (also, infobip-spring-data-jdbc-annotation-processor.)

When i generate Q class, most of entities are created well. But, Entities with @table( name = "somthing") annotation, Q class's constructor generated like this.

public QSlotGroup(String variable) {
    super(SlotGroup.class, forVariable(variable), null, "");
    addMetadata();
}

As you see, table name Field fill with "".

public RelationalPathBase(Class<? extends T> type, PathMetadata metadata, String schema,
        String table) {
    super(type, metadata);
    this.schema = schema;
    this.table = table;
    this.schemaAndTable = new SchemaAndTable(schema, table);
}

@Table(name = "slot_group") -> @Table("slot_group")

public QSlotGroup(String variable) {
    super(SlotGroup.class, forVariable(variable), null, "slot_group");
    addMetadata();
}

I solved it by changing it like this, but I think there may be other solutions or improvements, so I'm writing this issue.

@lpandzic
Copy link
Member

lpandzic commented Nov 8, 2022

Hm, something is missing here.
I've just pushed an annotation processor test that confirms that simple name work here - b8b4aa1

@lpandzic
Copy link
Member

lpandzic commented Nov 8, 2022

Are you using custom NamingStrategy?

@kimdg1105
Copy link
Author

@lpandzic No, i'm not use custom NamingStrategy.

In spring data jdbc java doc, Annotation Type 'Table' has two Optional Elements, 'name' and 'value'.
those two elements are the same description "The mapping table name."

@Table(name = "slot_group") -> @Table("slot_group")
@Table(name = "slot_group") -> @Table(value = "slot_group")

using @table like this, it works well. But when add 'name' element , it doesn't work.

@lpandzic
Copy link
Member

lpandzic commented Nov 9, 2022

Fixed in 7.2.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants