-
Notifications
You must be signed in to change notification settings - Fork 75
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
@id annotation doesn't work after recompilation #158
Comments
Sounds like it's related to #133 . IIRC @mpollmeier is working on an alternate |
That's true. |
@id annotation is just not working independently of classes order =( |
well that's a bit of a stretch, here's some working examples: https://github.com/mpollmeier/gremlin-scala/blob/master/gremlin-scala/src/test/scala/gremlin/scala/MarshallableSpec.scala |
@mpollmeier could you a give me a hint what I am doing wrong? This test fails for me =( @label("user")
case class UserWithId(@id id: Int, name: String, age: Int)
class GremlinQueriesSpec extends FlatSpec
with ScalaFutures with MustMatchers with BeforeAndAfterAllConfigMap {
behavior of "Gremlin queries"
it must "add vertex with id" in {
val user = new UserWithId(1, "anonymous", 35)
val graph = TinkerGraph.open.asScala
graph + user
val vertex = graph.V(user.id).head().toCC[UserWithId]
vertex must be eq user
}
}
|
Hmm, this looks like a regression - it works fine until gremlin-scala 3.3.1.2. I'll have a look. |
Actually, this was tradeoff based on a design decision back then. I would have preferred if it worked both ways, but IMO it's best to leave id assignment to the graph.
|
@mpollmeier Unfortunately, not an option for us. =( We get ids from external system and they are |
I'd say you have at least these alternatives:
|
I have an issue with the field annotated with
@id
.If the case class declaration goes after the class that calls
toCC
, theid
field is not filled in.If I move the case class to the beginning of the file, everything works well.
It is not a big issue when all your code is in the single file, but when the case classes are in a separate file, the
id
is filled depending on the order the sources are compiled - sometimes it works and after thegradle clean
it doesn't.The text was updated successfully, but these errors were encountered: