I need to store array data into database. But I don't find samples how to do that. I tried just treating array as a normal data type but it seems it doesn't work. Here is my code:
In the database table, I have 3 columns:
Id integer,
uLocation integer,
Prices integer(366)
In SQL, insert, update or query the table by using:
def InseartToDatabase(ItemPrices: ListBuffer[Int], Id: Int, uLocation: Int) = {
val prices = ItemPrices.toArray
DB.withConnection { implicit c =>
SQL("insert into task (Id, uLocation, Prices) values ({Id},{uLocation}, {Prices})").on('Id ->Id, 'uLocation->uLocation, 'Prices -> Prices).executeUpdate()
}
}
This doesn't work just silently and no exception reported. But next update just failed. If I remove the array fields, above code just works fine.
Also, I have no idea how to query it.