No limit embedded field name support
- Dominant language
- Java
- Stars
- 5.1k
- Forks
- 1.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
By default, Ignite will report an error if the Values entity is an embedded structure and the embedded field name is the same as the parent field name.
However, it seems that by making the following two small changes, embedded fields of any name can be supported.
```
class QueryEntityTypeDescriptor{
/**
* Adds property to the type descriptor.
*
* @param prop Property.
* @param sqlAnn SQL annotation, can be {@code null}.
* @param key Property ownership flag (key or not).
* @param failOnDuplicate Fail on duplicate flag.
*/
public void addProperty(QueryEntityClassProperty prop, QuerySqlField sqlAnn, boolean key, boolean failOnDuplicate) {
String propName = **prop.fullName();** // modify here
if (sqlAnn != null && !F.isEmpty(sqlAnn.name()))
propName = sqlAnn.name();
if (props.put(propName, prop) != null && failOnDuplicate) {
throw new CacheException("Property with name '" + propName + "' already exists for " +
(key ? "key" : "value") + ": " +
"QueryEntity [key=" + keyCls.getName() + ", value=" + valCls.getName() + ']');
}
fields.put(propName, prop.type());
if (key)
keyProps.add(propName);
}
}
QueryEntityClassProperty{
/**
* @return Alias.
*/
public String alias() {
// modify
return F.isEmpty(alias) ? **fullName()** : alias;
}
}
```
Contributor guide
Research direction
Start by locating QueryEntityTypeDescriptor.addProperty and QueryEntityClassProperty.alias(), then inspect how embedded Values properties are named and how duplicate names are handled. Done means embedded field names no longer collide solely because of the parent field name, while explicit SQL annotation names and duplicate detection continue to work as shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100