Discussion:
[Middlegen-user] findBy<relation>
m***@cybercom.se
2002-09-03 10:50:01 UTC
Permalink
Hello,

using the latest CVS version I don't get @ejb.finders for related beans.
Using a release from august I got for example in the sample ReservationBean:

* @ejb.finder
* signature="java.util.Collection
findByPerson(airline.interfaces.PersonLocal person)"
* result-type-mapping="Local"
* method-intf="LocalHome"
* query="SELECT DISTINCT OBJECT(o) FROM Reservation o WHERE o.person =
?1"

Is there a way to use predicates in the current release to generate these or
some other way?

Markus
Aslak Hellesøy
2002-09-03 11:07:07 UTC
Permalink
I removed the generation of these finders completely because they provide
the same functionality as CMR fields.
Example:

Reservation.findByPerson(person) <==> Person.getReservations()

-So if you have a person and want the reservations, you could (before I
removed it) use the findByPerson() or the getReservations() methods. 2 ways
to do the same thing is confusing.

I didn't discuss this with anyone before, so feedback is welcome!

Aslak
-----Original Message-----
Sent: 3. september 2002 14:49
Subject: [Middlegen-user] findBy<relation>
Hello,
Using a release from august I got for example in the sample
* signature="java.util.Collection
findByPerson(airline.interfaces.PersonLocal person)"
* result-type-mapping="Local"
* method-intf="LocalHome"
* query="SELECT DISTINCT OBJECT(o) FROM Reservation o WHERE o.person =
?1"
Is there a way to use predicates in the current release to
generate these or
some other way?
Markus
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
m***@cybercom.se
2002-09-03 12:17:06 UTC
Permalink
You are right, if there is simpler way to do things use that. The other way
just creates unnecessary finders.

Thanks,
Markus
-----Original Message-----
Sent: den 3 september 2002 15:06
Subject: RE: [Middlegen-user] findBy<relation>
I removed the generation of these finders completely because they provide
the same functionality as CMR fields.
Reservation.findByPerson(person) <==> Person.getReservations()
-So if you have a person and want the reservations, you could (before I
removed it) use the findByPerson() or the getReservations() methods. 2
ways
to do the same thing is confusing.
I didn't discuss this with anyone before, so feedback is welcome!
Aslak
-----Original Message-----
Sent: 3. september 2002 14:49
Subject: [Middlegen-user] findBy<relation>
Hello,
Using a release from august I got for example in the sample
* signature="java.util.Collection
findByPerson(airline.interfaces.PersonLocal person)"
* result-type-mapping="Local"
* method-intf="LocalHome"
* query="SELECT DISTINCT OBJECT(o) FROM Reservation o WHERE o.person
=
?1"
Is there a way to use predicates in the current release to
generate these or
some other way?
Markus
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
m***@cybercom.se
2002-09-05 07:02:01 UTC
Permalink
I guess this is only remotely Middlegen related (because the change brought
this up), but maybe someone has the answer anyway. When I rewrote my classes
using the form Person.getReservations() I get this error (using WLS 7.0):

java.lang.IllegalStateException: Attempted to access the collection valued
cmr-field, 'reservations', for bean, 'Person', outside the scope of a
transaction. All access to the collection must be performed during the
transaction in which the collection was initially retrieved.

What is strange is that I'm doing this from a stateless sessionbean and both
the sessionbean an entitybean has transaction set to required. Using
findBy... works fine. Anyone have a clue why this is?

Markus
-----Original Message-----
Sent: den 3 september 2002 15:06
Subject: RE: [Middlegen-user] findBy<relation>
I removed the generation of these finders completely because they provide
the same functionality as CMR fields.
Reservation.findByPerson(person) <==> Person.getReservations()
-So if you have a person and want the reservations, you could (before I
removed it) use the findByPerson() or the getReservations() methods. 2
ways
to do the same thing is confusing.
I didn't discuss this with anyone before, so feedback is welcome!
Aslak
-----Original Message-----
Sent: 3. september 2002 14:49
Subject: [Middlegen-user] findBy<relation>
Hello,
Using a release from august I got for example in the sample
* signature="java.util.Collection
findByPerson(airline.interfaces.PersonLocal person)"
* result-type-mapping="Local"
* method-intf="LocalHome"
* query="SELECT DISTINCT OBJECT(o) FROM Reservation o WHERE o.person
=
?1"
Is there a way to use predicates in the current release to
generate these or
some other way?
Markus
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Loading...