Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] How many belongsTo? and what about QBE?

Bellemo Maurizio

2010-09-01

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi,

 

I have four domain classes in my application.

 

class Event {

 

      static hasMany = [ broadcasts: Broadcast ]

     

     

Integer siEventId

     

      static constraints = {

            broadcasts(nullable: true)

      }

}

 

class Service {

     

      static hasMany = [ broadcasts: Broadcast ]

     

Integer siServiceId

     

     

      static constraints = {

            siServiceId(unique: true)

            broadcasts(nullable: true)

      }

}

 

class Serie {

     

      static hasMany = [ broadcasts: Broadcast ]

 

      Integer groupId

 

      static constraints = {

            groupId(unique: true)

      }

}

 

class Broadcast {

     

      static belongsTo = [ service: Service,

                             event: Event,

                             serie: Serie ]

 

      static constraints = {

            serie( nullable : true )

      }

}

 

1.       Is it possible to have more than one belongsTo in one domain class???

2.       Is it also possible to use QBE this way?

def broadcastInstance = Broadcast.find(service: new Service(siServiceId: serviceId), event: new Event(siEventId: eventId))

because I got an error message of this type

No signature of method: eu.sytel.Broadcast.find() is applicable for argument types: (java.util.LinkedHashMap) values: [[service:eu.sytel.Service : null, event:eu.sytel.Event : null]]

Possible solutions: find(java.lang.String), find(java.lang.Object), find(groovy.lang.Closure), find(java.lang.String, java.util.Map), find(java.lang.String, java.util.Collection), find(java.lang.String, [Ljava.lang.Object;)

 

 

Thanks

 

3342704206_1025960

 

Maurizio Bellemo
Consultant

 

E-mail:   m.bellemo@reply.eu

Mobile:  004915257907704

Desk:      00492113399026

Fax:        004921133990599

 

Sytel Reply GmbH

Hansaallee 201, D-40549 Duesseldorf

Geschaeftsfuehrer: Giovanni Ambrogio, Daniele Angelucci

Amtsgericht Duesseldorf, HRB 60665

 

www.reply.eu

 



--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
©2008 gg3721.com - Jax Systems, LLC, U.S.A.