Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Scala and databases
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Konstantinos Kougios  
View profile  
 More options Nov 2 2012, 5:59 pm
From: Konstantinos Kougios <kostas.koug...@googlemail.com>
Date: Fri, 02 Nov 2012 21:58:48 +0000
Local: Fri, Nov 2 2012 5:58 pm
Subject: Re: [scala-user] Re: Scala and databases

Thanks for the example Flavio, ok I see. Why the emphasis on
transactional memory and efficient memory usage? What apps are you
targeting?  Also what's your naming conventions for mapping to the tables?

mapperdao uses a different approach and your example would look like

class Stock(val code:String,val categories:Set[Category]) // or
List[Category] etc
class Category(val name:String,val stocks:Set[Stock])

You can too use an intermediate StockCategory entity if you prefer.

MapperDao gives direct control on persistence and transactions to client
code, i.e.

val tx = Transaction.get(txManager, Propagation.Nested,
Isolation.ReadCommited, -1)
// will insert category and insert/update related Stock in 1 transaction
val inserted = tx { () =>
     mapperDao.insert(CategoryEntity, category)

}

MapperDao supports nested transactions too along with updates/deletes.
All web frameworks are supported as mapperdao only needs a DataSource to
work. A major feature of mapperdao is support for immutable classes,
something that i.e. hibernate doesn't support, along with a typesafe DSL
for querying.

On 02/11/12 20:06, Flávio W. Brasil wrote:

> Hello.

> Activate is designed to be simple. OO is straightforward to map data
> and relations. Instead of trying to create a magical relational
> many-to-many concept, you do as should do in OO: create a relation entity.

> class Stock(var code: String) extends Entity {
> def categories = select[StockCategory].where(_.stock :==
> this).map(_.category)
> }
> class Category(var name: String) extends Entity {
> def stocks = select[StockCategory].where(_.category :== this).map(_.stock)
> }
> case class StockCategory(stock: Stock, category: Category) extends Entity

> To map the same domain using separate entity declaration and
> "implicit" many-to-many relation you have to produce much more code.
> Activate 1.1 version (to be released this month) has support for Lists
> too:

> class Person(var name: String, var contacts: List[Contact]) extends Entity

> There are characteristics that makes Activate different from Slick,
> Mapperdao, Squeryl, Hibernate, etc.
> For example: transparent persistence, optimistic locking with read and
> write validation, nested transactions, efficient memory usage, design
> by contract, migrations dsl,  relational and non relational database
> support, mass update/delete, play framework support.
> It's a new way to do persistence: simple, highly scalable and consistent.

> --
> Flávio W. Brasil
> http://activate-framework.org
> {persistence as it should be}

> On Thursday, 1 de November de 2012 at 19:43, Konstantinos Kougios wrote:

>> I had a look at activate, I couldn't find a complete example with say
>> a many-to-many relationship between 2 entities. From the table DDL to
>> mappings (if any) and some queries. Do you have a link?

>> On 01/11/12 12:52, Rafał Krzewski wrote:
>>> W dniu czwartek, 1 listopada 2012 11:50:07 UTC+1 użytkownik
>>> Konstantinos Kougios napisał:
>>>> There doesn't seem to be other ORM tools for Scala.

>>> Well, there is at least one other:
>>> https://github.com/fwbrasil/activate :)

>>> Cheers,
>>> Rafał


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.