Hi,

TEXT is currently mapped to CLOB. Unfortunately I don't have a
workaround for you, I'm sorry. I will add a feature request to allow
to remap such data types, but it will take some time until this is
implemented.

Regards,
Thomas

On Mon, Oct 20, 2008 at 10:06 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> I'm having trouble getting H2/Hibernate to recognize the Postgresql
> "text" type.   I have defined a column in Java as an enumerated type,
> mapping that to "text default 'NOT_NEEDED" in Postgres.
>
>    public static enum PostProc { NOT_NEEDED, NEEDED, COMPLETED };
>
> Then in my model class I have:
>
>    @Column(name = "postproc", columnDefinition = "text default
> 'NOT_NEEDED'")
>    @Check(constraints = "(postproc in ('NOT_NEEDED', 'NEEDED',
> 'COMPLETED')")
>    @Enumerated(EnumType.STRING)
>    public PostProc getPostProcStatus() {
>        return postProcStatus;
>    }
>
>
> testGetRunningJobs(com.example.UnitTest)  Time elapsed: 0.061 sec  <<<
> FAILURE!
> java.lang.ClassCastException: java.io.BufferedReader
>        at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:95)
>        at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>        at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>        at
> org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:
> 2101)
>        at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>        at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
>        at org.hibernate.loader.Loader.getRow(Loader.java:1206)
>        at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>        at org.hibernate.loader.Loader.doQuery(Loader.java:701)
>        at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:
> 236)
>        at org.hibernate.loader.Loader.doList(Loader.java:2213)
>        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
>        at org.hibernate.loader.Loader.list(Loader.java:2099)
>        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
>        at
> org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:
> 338)
>        at
> org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:
> 172)
>        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
>        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
>        at com.example.MyClass$9.doInHibernate(MyClass.java:148)
>        at
> org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:
> 372)
>        at
> org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:
> 338)
>
>
>
> For historical reasons, our codebase uses this Postgres-specific
> "text" type rather than a varchar.   Can this be made to work in H2?
> I also tried adding a domain, but that did not help:
>
>            st.executeUpdate("CREATE domain IF NOT EXISTS TEXT AS
> VARCHAR;");
>
>
> Many thanks in advance for help with this.
> L
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to