Tuesday, March 25, 2008

Secondary Table not working in EJB

Had a customer and an embedded address. It would not use the EMBEDDED_ADDRESS table, instead it created a column called street in the customer table and used that.


@Entity
@Table(name = "CUSTOMER")
@SecondaryTable(name = "EMBEDDED_ADDRESS", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "addressId")})
public class CustomerBean {

@Id @GeneratedValue(strategy=GenerationType.AUTO)
private int id;
private String name;
private String street;

public CustomerBean(){}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Column(name = "street", table = "EMBEDDED_ADDRESS")
public String getStreet()
{
return street;
}

public void setStreet(String street) {
this.street = street;
}



}

Setting up Cygwin

Set home location by set HOME=E:\cygwinhome in cygwin.bat

Make it run you .bashrc every time you start a cygwin shell by creating a file .bash_profile with the following

case $- in
*i*) [ -f ~/.bashrc ] && [ -r ~/.bashrc ] && . ~/.bashrc
esac

from http://www.issociate.de/board/post/397417/Cygwin_Bash_problem.html

Friday, March 14, 2008

Configure sql server 2005 express to allow TCP/IP connections

http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx