private boolean invalid=false;
@Column(name="INVALID", columnDefinition = "BIT(1) default 0")
public boolean isInvalid() {
return invalid;
}
public void setInvalid(boolean invalid) {
this.invalid = invalid;
}
Should work for mysql only.
Tuesday, July 7, 2009
Monday, July 6, 2009
Junit and Spring
Here is sample code for Junit testing with spring/hibernate.
@ContextConfiguration(locations = { "/applicationContext-hibernate-test.xml" })
public class TestDaoImplTest extends AbstractJUnit4SpringContextTests {
@Autowired
TestDao testDao;
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void test() {
testDao.callyourmethod();
}
}
@ContextConfiguration(locations = { "/applicationContext-hibernate-test.xml" })
public class TestDaoImplTest extends AbstractJUnit4SpringContextTests {
@Autowired
TestDao testDao;
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void test() {
testDao.callyourmethod();
}
}
Wednesday, July 1, 2009
Convert Calendar to Date object java
Suppose the given date string is June, 30 2009
First we will make a Calendar object and convert it to Date Object
Calendar calendar = new GregorianCalendar(2009, 6 - 1, 30);
Date dateObject = new Date(calendar.getTimeInMillis());
So here it is, java.util.Calendar Object converted to java.util.Date object
First we will make a Calendar object and convert it to Date Object
Calendar calendar = new GregorianCalendar(2009, 6 - 1, 30);
Date dateObject = new Date(calendar.getTimeInMillis());
So here it is, java.util.Calendar Object converted to java.util.Date object
Subscribe to:
Posts (Atom)