GRAILS-1019: Allowing expressions to be used with the 'disabled' attribute for g...
[grails.git] / test / groovy / org / codehaus / groovy / grails / orm / hibernate / TablePerSubclassWithCustomTableNameTests.groovy
blob0bb5ece42b0009ad60fefbffb046501541bf88dc
1 package org.codehaus.groovy.grails.orm.hibernate
3 import javax.sql.DataSource
5 /**
6 * Created by IntelliJ IDEA.
7 * User: grocher
8 * Date: Jan 23, 2008
9 * Time: 9:04:47 PM
10 * To change this template use File | Settings | File Templates.
12 class TablePerSubclassWithCustomTableNameTests extends AbstractGrailsHibernateTests{
14 protected void onSetUp() {
15 gcl.parseClass '''
16 class Animal {
17 Long id
18 Long version
19 String name
20 static mapping = {
21 tablePerSubclass true
22 table "myAnimals"
26 class Dog extends Animal {
27 String bark
28 static mapping = {
29 table "myDogs"
32 class Cat extends Animal {
33 String meow
34 static mapping = {
35 table "myCats"
38 '''
43 void testGeneratedTables() {
44 DataSource ds = applicationContext.getBean('dataSource')
46 def con
47 try {
48 con = ds.getConnection()
49 def statement = con.prepareStatement("select * from myDogs")
50 statement.execute()
51 statement = con.prepareStatement("select * from myCats")
52 statement.execute()
53 } finally {
54 con.close()