Update: to be a little more precise.

case class Y
case class MyObj(val a:String: val b:List[Y])

I save a MyObj, its loaded back as a document and the identityHashCode of 
the b attribute is identical to the saved object's.


On Sunday, April 24, 2016 at 4:24:47 PM UTC-7, Stuart Reynolds wrote:
>
> I'm working on some extensions to the soriento scala wrapper for orientdb.
> I'm trying to write some unit tests like this:
>
>
>
>     implicit val db: ODatabaseDocumentTx = new ODatabaseDocumentTx(
> "memory:jsondb")
>     db.create()
>     ...
>     db.save(myObj)
>
>     ...
>     db.queryBySql[MyObj]("select * from MyObj;")
>
> queryBySql is provided by Soriento.
> What I find is that the object saved to the DB has the same identity 
> (according to System.identityHashCode), as the object loaded (i.e. it was 
> never serialized -- the same reference is received from the query, as was 
> saved). Therefore, serialization is not tested.
>
> This makes sense -- presumably the memory database has no need to 
> serialize. However, my unit tests really need to force serialization to 
> happen. I get the same result if creating a plocal.
>
> So, what's the best way to set up and tear down an orientdb DB for unit 
> tests so that serialization happens for saves and loads? (I can't rely on 
> an external DB since other people will need to run the unit test.)
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to