[Persistence, JBoss/CMP, Hibernate, Database] - Hibernate 3.2 aggregation functions change
by mraben
Hi everyone,
Hibernate3.2 Migration Guide http://www.hibernate.org/250.html#A42
mentions "Changed aggregation (count, sum, avg) function return types".
To use the classic pre Hibernate 3.2 aggregation functions, the following help is given:
----
If you cannot change to the JPA compliant type handling the following code can be used to provide "classic" Hibernate behavior for HQL aggregation.
Configuration classicCfg = new Configuration();
classicCfg.addSqlFunction( "count", new ClassicCountFunction());
classicCfg.addSqlFunction( "avg", new ClassicAvgFunction());
classicCfg.addSqlFunction( "sum", new ClassicSumFunction());
SessionFactory classicSf = classicCfg.buildSessionFactory();
----
Is something like this also possible in declarative instead of programmatic configuration?
My Hibernate configuration is deployed in JBoss AS 4.0.5 via a har archive, and i don´t know, how to switch to the old aggregation functions there.
Thanks for your help.
Markus
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983765#3983765
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983765
19Â years, 6Â months
[JBossWS] - JAXBDeserializer unmarshalling
by alesj
I have this unmarshalling problem:
|
| @XmlRootElement(name = "createAccountReturn")
| public class Account implements Serializable {
|
| @XmlElement(name = "username") public String username;
| @XmlElement(name = "password") public String password;
| @XmlElement(name = "creationDate") public Date creationDate;
|
| public String toString() {
| return "Account{" +
| "username='" + username + '\'' +
| ", password='" + password + '\'' +
| ", creationDate=" + creationDate +
| '}';
| }
|
| }
|
| public static void main(String[] args) {
| Class javaType = Account.class;
| String xml = "<createAccountReturn xmlns='http://localhost:8080/jaxrpc/axis/AccountService'><password>password12</password><creationDate>2006-11-07T13:44:01.515Z</creationDate><username>creator</username></createAccountReturn>";
| try {
| JAXBContext jaxbContext = JAXBContext.newInstance(javaType);
| Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
| ByteArrayInputStream ins = new ByteArrayInputStream(xml.getBytes("UTF-8"));
| JAXBElement jbe = unmarshaller.unmarshal(new StreamSource(ins), javaType);
| Object value = jbe.getValue();
| System.out.println("value = " + value);
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
|
trying to unmarshall this xml:
| <createAccountReturn xmlns='http://localhost:8080/jaxrpc/axis/AccountService'>
| <password>password12</password>
| <creationDate>2006-11-07T13:44:01.515Z</creationDate>
| <username>creator</username>
| </createAccountReturn>
|
But I always get value = Account{username='null', password='null', creationDate=null}.
No idea what I'm doing wrong...
Rgds, Ales
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983764#3983764
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983764
19Â years, 6Â months