Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Doubt about GORM

Bellemo Maurizio

2010-08-24

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi all,

 

I have two classes

 

class Event {

 

      static belongsTo = [service: Service]

 

Integer siEventId

     

      static constraints = {

siEventId(unique: true)

      }

}

 

And

 

class Service {

     

      static hasMany = [events: Event]

     

      Integer siServiceId

     

static constraints = {

            siServiceId(unique: true)         

events(nullable: true)

      }

}

 

I am trying to check if – for a specific object serviceInstance – I already have an Event with an Integer eventId.

 

I tried to do the following…

 

def eventInstance = Event.findAllByServiceAndSiEventId( serviceInstance, eventId )

 

But it seems not to be the right one… eventInstance is always null. Any suggestions?



--
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.