Author: thomas.heute(a)jboss.com
Date: 2008-07-29 08:01:32 -0400 (Tue, 29 Jul 2008)
New Revision: 11609
Added:
branches/JBoss_Portal_Branch_2_7/cms/src/main/org/jboss/portal/cms/hibernate/MaterializedBlobType.java
Modified:
branches/JBoss_Portal_Branch_2_7/cms/src/resources/hibernate/domain.hbm.xml
Log:
Default to a schema compatible with all database (including Sybase)
Added:
branches/JBoss_Portal_Branch_2_7/cms/src/main/org/jboss/portal/cms/hibernate/MaterializedBlobType.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/cms/src/main/org/jboss/portal/cms/hibernate/MaterializedBlobType.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/cms/src/main/org/jboss/portal/cms/hibernate/MaterializedBlobType.java 2008-07-29
12:01:32 UTC (rev 11609)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.cms.hibernate;
+
+import java.sql.Types;
+
+import org.hibernate.type.AbstractBynaryType;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class MaterializedBlobType extends AbstractBynaryType
+{
+ public int sqlType()
+ {
+ return Types.BLOB;
+ }
+
+ public String getName()
+ {
+ return "materialized-blob";
+ }
+
+ public Class getReturnedClass()
+ {
+ return byte[].class;
+ }
+
+ protected Object toExternalFormat(byte[] bytes)
+ {
+ return bytes;
+ }
+
+ protected byte[] toInternalFormat(Object bytes)
+ {
+ return (byte[]) bytes;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/cms/src/resources/hibernate/domain.hbm.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/cms/src/resources/hibernate/domain.hbm.xml 2008-07-29
10:48:14 UTC (rev 11608)
+++ branches/JBoss_Portal_Branch_2_7/cms/src/resources/hibernate/domain.hbm.xml 2008-07-29
12:01:32 UTC (rev 11609)
@@ -60,7 +60,7 @@
<property
name="data"
column="NODE_DATA"
- type="binary"
+ type="org.jboss.portal.cms.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
@@ -79,7 +79,7 @@
<property
name="data"
column="PROP_DATA"
- type="binary"
+ type="org.jboss.portal.cms.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
@@ -98,7 +98,7 @@
<property
name="data"
column="REFS_DATA"
- type="binary"
+ type="org.jboss.portal.cms.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
@@ -136,7 +136,7 @@
<property
name="data"
column="NODE_DATA"
- type="binary"
+ type="org.jboss.portal.cms.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
@@ -155,7 +155,7 @@
<property
name="data"
column="PROP_DATA"
- type="binary"
+ type="org.jboss.portal.cms.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>
@@ -174,7 +174,7 @@
<property
name="data"
column="REFS_DATA"
- type="binary"
+ type="org.jboss.portal.cms.hibernate.MaterializedBlobType"
length="100000000"
not-null="true"/>
</class>