Problem with join

1 view
Skip to first unread message

Rafael Jesús

unread,
Jun 28, 2009, 4:35:16 PM6/28/09
to weblocks
Hi:

I've received this Internal Server Error from Hunchentoot:

---8<---8<---8<---8<---
Internal Server Error

While accessing database #<POSTGRESQL-SOCKET-DATABASE clio/dedalo_gam/
dedalo_gam OPEN {1004890221}>
with expression "SELECT
ACTUACION.OPERARIO_ID,ACTUACION.ID,ACTUACION.FECHA_INICIO,ACTUACION.FECHA_FIN,ACTUACION.CLIENTE_ID,ACTUACION.CLIENTE
FROM ACTUACION ORDER BY ACTUACION.CLIENTE ASC LIMIT 0 OFFSET 0":
Error POSTGRESQL-ERROR / ERROR: no existe la columna
actuacion.cliente en carácter 107

has occurred.

Hunchentoot 1.0.0 (SBCL 1.0.27.debian) at localhost:8080
---8<---8<---8<---8<---

The definition of the view class is this:
---8<---8<---8<---8<---
(clsql:def-view-class actuacion ()
((cliente :accessor actuacion-cliente
:db-kind :join
:db-info (:join-class cliente
:home-key cliente-id
:foreign-key id
:set nil))
(cliente-id
:type integer
:initarg :cliente-id)
(fecha-fin :accessor fecha-fin
:type universal-time
:initarg :fecha-fin)
(fecha-inicio :accessor fecha-inicio
:type universal-time
:initarg :fecha-inicio)
(id :accessor id
:db-kind :key
:db-constraints (:not-null :unique)
:type integer
:initarg :id)
(operario :accessor actuacion-operario
:db-kind :join
:db-info (:join-class operario
:home-key operario-id
:foreign-key id
:set nil))
(operario-id
:type integer
:initarg :operario-id))
(:base-table actuacion))
---8<---8<---8<---8<---

So it seems that weblocks is not aware of the join-class (I'm using
clsql 4.0.4). Am I forgetting something?

Thanks in advance,

Leslie P. Polzer

unread,
Jun 30, 2009, 3:48:09 PM6/30/09
to weblocks
On Jun 28, 10:35 pm, Rafael Jesús <wheelkil...@gmail.com> wrote:

> So it seems that weblocks is not aware of the join-class

Yes.

I think the following thread might be helpful:

http://groups.google.com/group/weblocks/browse_thread/thread/4bf4e34a27d7fb8f/e0ad4ce3c7c60901

Rafael Jesús

unread,
Jul 1, 2009, 6:22:25 PM7/1/09
to weblocks
Hi again:

If I have understood correctly, I missed the join declarations on the
related classes ('cliente' and 'operario'). So I've done the
corresponding joins in the related classes and I've made some changes
in the view class 'actuacion', but the message is always the former
one.

---8<---8<---8<---8<---8<---8<---

(clsql:def-view-class actuacion ()
((cliente :accessor actuacion-cliente
:db-kind :join
:db-info (:join-class cliente
:home-key cliente-id
:foreign-key id
:set t))
(cliente-id
:type integer
:initarg :cliente-id)
(fecha-fin :accessor fecha-fin
:type universal-time
:initarg :fecha-fin)
(fecha-inicio :accessor fecha-inicio
:type universal-time
:initarg :fecha-inicio)
(id :accessor actuacion-id
:db-kind :key
:db-constraints (:not-null :unique)
:type integer
:initarg :id)
(operario :accessor actuacion-operario
:db-kind :join
:db-info (:join-class operario
:home-key operario-id
:foreign-key id
:set t))
(operario-id
:type integer
:initarg :operario-id))
(:base-table actuacion))

(clsql:def-view-class cliente ()
((actuacion :accessor cliente-actuacion
:db-kind :join
:db-info (:join-class actuacion
:home-key id
:foreign-key cliente-id
:set t))
(id :accessor cliente-id
:db-kind :key
:db-constraints (:not-null :unique)
:type integer
:initarg :id)
(nombre :accessor nombre
:type (string 128)
:initarg :nombre))
(:base-table cliente))

(clsql:def-view-class operario ()
((actuacion :accessor operario-actuacion
:db-kind :join
:db-info (:join-class actuacion
:home-key id
:foreign-key operario-id
:set t))
(apellidos :accessor apellidos
:type (string 128)
:initarg :apellidos)
(id :accessor operario-id
:db-kind :key
:db-constraints (:not-null :unique)
:type integer
:initarg :id)
(nombre :accessor nombre
:type (string 128)
:initarg :nombre))
(:base-table operario))
---8<---8<---8<---8<---8<---8<---

Many, many thanks for your time.

Leslie P. Polzer

unread,
Jul 2, 2009, 9:04:32 AM7/2/09
to webl...@googlegroups.com

Rafael Jesús wrote:

> If I have understood correctly, I missed the join declarations on the
> related classes ('cliente' and 'operario'). So I've done the
> corresponding joins in the related classes and I've made some changes
> in the view class 'actuacion', but the message is always the former
> one.

As described in the link I posted you also need to
customize the ON-QUERY slot of your datagrid.

The standard queries don't take joins into account AFAIK.

Of course you could also try to add this to Weblocks
directly so the right thing happens automagically.

Sistemas

unread,
Jul 6, 2009, 2:47:47 AM7/6/09
to webl...@googlegroups.com
On Jueves 02 Julio 2009 15:04:32 Leslie P. Polzer escribió:
> Rafael Jesús wrote:
> > If I have understood correctly, I missed the join declarations on the
> > related classes ('cliente' and 'operario'). So I've done the
> > corresponding joins in the related classes and I've made some changes
> > in the view class 'actuacion', but the message is always the former
> > one.
>
> As described in the link I posted you also need to
> customize the ON-QUERY slot of your datagrid.
>
Well it seems that it's time to learn something more about weblocks :)


> The standard queries don't take joins into account AFAIK.
>
> Of course you could also try to add this to Weblocks
> directly so the right thing happens automagically.
>
That's the next step in my plan of learning weblocks.


Thanks again.
Rafael.
--
+----------
| Departamento de Sistemas <sist...@dedaloingenieros.com>
| Teléfono fijo: 952 602 959
| Fax: 952 602 959
| Dirección: C/ Afligidos 2, 3º Derecha, 29015 Málaga
| Dédalo Ingenieros, S.L.: http://www.dedaloingenieros.com/
| PGP: http://pgp.rediris.es:11371/pks/lookup?op=index&search=0x1899F325
+---------------------
signature.asc
Reply all
Reply to author
Forward
0 new messages