Separators for composite / embedded column names #60

Open
snazy opened this Issue Jan 15, 2013 · 6 comments

Comments

Projects
None yet
2 participants

snazy commented Jan 15, 2013

Would be nice to have separators between the logical column name parts.

For example: The column "namemainfirstName" in the following screenshot is the field "firstName" in the composite "name" with id "main".

It would get more readable with separators.
And (I did not try it) but the following might generate a column name conflict:

@nosqlentity
class User {
String avalue;
@nosqlembedd
A a;
}
@nosqlembeddable
class A {
String value;
}

Would say: it is possible that a composite field (NoSqlEmbedded in List) accidently might get the same column name as another field - when the embedded's id is specified by the user.

Bildschirmfoto 2013-01-15 um 23 34 15

Owner

deanhiller commented Jan 15, 2013

yes, if you have two ids that are the same, just like in mgr.put(), they would overwrite each other...and yes it is really a Set with the hashCode/equals being based off of the id.

you make a very good point in the avalue and avalue.

We thought about separators actually and were just not sure as if someone has an id of asdf-qwer and we make the separator a -, then reading in the value could be big trouble since there was already a separator in use. If you have ideas on how to resolve this, we would love to hear them as it is an interesting issue.

snazy commented Jan 15, 2013

Hmm... of course ... a separator can be part of the id itself :-(

IMHO is would be sufficient to let the user configure the separator char in NoSqlEntityManagerFactory and let it default to for example ':'. It is persisted DboDatabaseMeta and cannot be changed.
Any separator character in an ID results in an exception. This would be fine, because these IDs are usually technical IDs.

Owner

deanhiller commented Jan 15, 2013

that is probably valid....I had thought of that before but literally just made the random decision, but supporting both separators and no separators should be fine....our goal is to support legacy models which may not have separators as well(and there are probably legacy models that do have separators too so it is definitely needed).

snazy commented Jan 15, 2013

I would prefer separators 👍

Owner

deanhiller commented Jan 15, 2013

oh, I was just saying we should do both ;) and will use this ticket to do so.

snazy commented Jan 15, 2013

fine :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment