/** * TestCube is an enterprise Test management tool. * Copyright (C) 2011 JatakaSource Ltd. * * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * TestCube 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 TestCube. If not, see <http://www.gnu.org/licenses/>. */ package org.jatakasource.testcube.model.product; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; @Entity @Table(name = "CUB_PRODUCTS") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class Product extends ProductPojo { private static final long serialVersionUID = -8976401396332090714L; private static final String[][] UNIQUE_CONSTRAINTS = new String[][] { new String[] { Product.FIELD_NAME }, new String[] { Product.FIELD_DESC } }; public Product() { super(); } public Product(Long id) { setId(id); } @Id @SequenceGenerator(name = "CUB_PRODUCTS_SEQ", sequenceName = "CUB_PRODUCTS_SEQ", initialValue = 0) @GeneratedValue(strategy = GenerationType.AUTO, generator = "CUB_PRODUCTS_SEQ") public Long getId() { return super.getId(); } @Override public void setId(Long id) { super.setId(id); } @Override @Column(unique = true, length = FIELD_NAME_LENGTH, nullable = false) public String getName() { return super.getName(); } @Override public void setName(String name) { super.setName(name); } @Override @Column(unique = true, length = FIELD_DESC_LENGTH, nullable = false) public String getDescription() { return super.getDescription(); } @Override public void setDescription(String description) { super.setDescription(description); } @Override @Column public boolean isEnabled() { return super.isEnabled(); } @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); } @Override public String[][] uniqueConstraints() { return UNIQUE_CONSTRAINTS; } }