设置数据源' ALL'对于所有grails域映射GORM

时间:2015-09-15 14:31:06

标签: grails gorm

我想添加其他数据源以与GORM一起使用。

DataSource.groovy中

// Update the data for all
var join = d3.select(svg)
    .selectAll("rect")
    .data(data);

// Append new data.
join.enter().append("rect")      
    .attr("class", function (d, i) {
        var low = ""
        i == minIndex ? low = " low" : "";
        return "bar" + " " + "index_" + i + low;
    })

// Update everyone.
join.attr("width", barWidth)
    .attr("x", function (d, i) {
        return barWidth * i + barSpace * i;
    })
    .attr("y", chartHeight)
    .attr("height", 0)
    .transition()
    .delay(function (d, i) {
        return i * 100;
    })
    .attr("y", function (d, i) {
        return chartHeight - y(d);
    })
    .attr("height", function (d) {
        return y(d);
    });

但是已经有很多域类,我没有时间在每个类中定义静态映射。

Domain.groovy

// Link data to your graph and get the join
var join = svg.selectAll('rect')
    .data(data);

// Update data already there
join.attr('x', 0);

// Append the new data
join.enter().append('rect')
    .attr('x', 0);

// Remove exiting elements not linked to any data anymore
join.exit().remove();

// Update all resulting elements
join.attr('x', 0);

可以配置grails来设置数据源' ALL'对于所有域名?

1 个答案:

答案 0 :(得分:1)

您可以将此类内容添加到 grails-app / conf / application.groovy

grails.gorm.default.mapping = {
    datasource 'ALL'
}

请参阅documentation了解Grails映射。