Hi everyone,
I have used Hibernate with BEA Weblogic 3.1 and I have not had any problems.
Now I'm passing to BEA 4.0 and I'm starting to have some problems.
Using the same war file, with BEA 4.0 I have the following Exception:
org.hibernate.QueryException: undefined alias: TConfCodecPK [select TConfCodecPK.subtype FROM hibernate.classes.TConfCodec where confURI = 'sip:conf1239010359177@telecomitalia.it' and policy = 'allowed']
TConfCodec is the java class that maps the sql table, instead TConfCodecPK is the composite-id.
subtype is an element of composite-id TConfCodecPK. To read it from the table using BEA 3.1 I have had no problems, but now using BEA 4.0 I have it.
I don't know if I'm doing something wrong.
Please, help me
Here is described how they are composed
TConfCodec java class
public class TConfCodec { private String media_label; private String policy; private String name; private TConfCodecPK tConfCodecPK; public TConfCodec() { } public TConfCodec(String confURI, String media_type,String media_label,String subtype,String policy,String name) { this.name = name; this.media_label = media_label; this.policy = policy; tConfCodecPK = new TConfCodecPK(confURI, media_type,subtype); }
public String getMedia_label() { return media_label; }
public void setMedia_label(String media_label) { this.media_label = media_label; }
public String getPolicy() { return policy; }
public void setPolicy(String policy) { this.policy = policy; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public TConfCodecPK getTConfCodecPK() { return tConfCodecPK; }
public void setTConfCodecPK(TConfCodecPK confCodecPK) { tConfCodecPK = confCodecPK; } public String getConfURI() { return this.tConfCodecPK.getConfURI(); }
public void setConfURI(String confURI) { this.tConfCodecPK.setConfURI(confURI); }
public String getMedia_type() { return this.tConfCodecPK.getMedia_type(); }
public void setMedia_type(String media_type) { this.tConfCodecPK.setMedia_type(media_type); }
public String getSubtype() { return this.tConfCodecPK.getSubtype(); }
public void setSubtype(String subtype) { this.tConfCodecPK.setSubtype(subtype); } }
TConfcodecPK
public class TConfCodecPK implements Serializable { private String confURI; private String media_type; private String subtype; public TConfCodecPK() { } public TConfCodecPK(String confURI, String media_type, String subtype) { this.confURI = confURI; this.media_type = media_type; this.subtype = subtype; }
public String getConfURI() { return confURI; } public void setConfURI(String confURI) { this.confURI = confURI; } public String getMedia_type() { return media_type; } public void setMedia_type(String media_type) { this.media_type = media_type; } public String getSubtype() { return subtype; } public void setSubtype(String subtype) { this.subtype = subtype; } }
TConfCodec.hbm.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping> <class name="hibernate.classes.TConfCodec" table="t_conf_codecs"> <composite-id name="TConfCodecPK" class="hibernate.classes.TConfCodecPK"> <key-property name="confURI"/> <key-property name="media_type"/> <key-property name="subtype"/> </composite-id> <property name="media_label"/> <property name="policy"/> <property name="name"/> </class> </hibernate-mapping>
table t_conf_codecs
CREATE TABLE `t_conf_codecs` ( `confURI` varchar(100) NOT NULL, `media_type` varchar(10) NOT NULL, `media_label` varchar(15) NOT NULL, `subtype` varchar(16) NOT NULL, `policy` enum ('allowed','disallowed') NOT NULL DEFAULT 'allowed', `name` varchar(10) NOT NULL, /* Keys */ PRIMARY KEY (`confURI`, `media_type`, `subtype`) )
|