Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] No inserts happen on table

Hi,

Sorry to bother you guys with this somehow stupid question but I fail to
see the reason behind not seeing INSERTs happen into ADDRESS table.
After commit ADDRESS table is still empty and no exception happen no
error either in EclipseLink log.

Environment:
    Java version: 1.6.0_20
    EclipseLink OSGi bundle version: 2.0.2
    Postgres: 8.4
    Postgres JDBC: 8.4-701.jdbc4
Dunno if it matters that am running this into Apache Felix Karaf OSGi
container but I guess not as am getting log from persistence provider.

I have the following object model:


@Entity
public class AppUser implements Serializable {

    @Id
    private String userName;
    @Column
    private String password;
    @Embedded
    private AppUserProfile profile;
...
}

@Embeddable
public class AppUserProfile {

    @Column
    private String userFirstName;
    @Column
    private String userMiddleName;
    @Column
    private String userLastName;
    @Column
    private String phoneNumber;
    @Column
    private String mobileNumber;
    @Column
    private String fax;
    @OneToMany
    @JoinColumn(name="userName",nullable=false)
    private List<Address> address;
...
}

@Entity
public class Address {

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private long addressId;
    @Column
    private String addressLine1;
    @Column
    private String addressLine2;
    @Column
    private String town;
    @Column
    private int zipCode;
    @Column
    private String country;
...
}

The peace of code that insert into the tables:
        AppUser user = new AppUser();
        user.setUserName("daoud");
        user.setPassword("secret");
        AppUserProfile profile = new AppUserProfile();
        profile.setUserFirstName("Daoud");
        profile.setUserMiddleName("AbdelMonem");
        profile.setUserLastName("Faleh");
        Address address = new Address();
        address.setAddressLine1("some place");
        address.setTown("Tunis");
        address.setZipCode(1001);
        address.setCountry("Tunisia");
        List<Address> userAddresses = new ArrayList<Address>();
        userAddresses.add(address);
        profile.setAddress(userAddresses);
        user.setProfile(profile);
        service.addUser(user);


service just do em.persist(user).


The Log is as follow (am using drop-and-create and logging.level FINE)
[EL Config]: 2010-06-09
15:59:36.994--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
access type for the persisten
t class [class tn.com.bitaka.usersmanager.model.Address] is set to [FIELD].
[EL Config]: 2010-06-09
15:59:37.025--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
access type for the persisten
t class [class tn.com.bitaka.usersmanager.model.AppUser] is set to [FIELD].
[EL Config]: 2010-06-09
15:59:37.028--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
access type for the persisten
t class [class tn.com.bitaka.usersmanager.model.AppUserProfile] is set
to [FIELD].
[EL Config]: 2010-06-09
15:59:37.042--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
target entity (reference) cla
ss for the one to many mapping element [field address] is being
defaulted to: class tn.com.bitaka.usersmanager.model.Address.
[EL Config]: 2010-06-09
15:59:37.044--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
alias name for the entity cla
ss [class tn.com.bitaka.usersmanager.model.Address] is being defaulted
to: Address.
[EL Config]: 2010-06-09
15:59:37.047--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
table name for entity [class
tn.com.bitaka.usersmanager.model.Address] is being defaulted to: ADDRESS.
[EL Config]: 2010-06-09
15:59:37.062--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d zipCode] is being defaulted to: ZIPCODE.
[EL Config]: 2010-06-09
15:59:37.064--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d town] is being defaulted to: TOWN.
[EL Config]: 2010-06-09
15:59:37.064--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d addressLine2] is being defaulted to: ADDRESSLINE2.
[EL Config]: 2010-06-09
15:59:37.066--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d addressId] is being defaulted to: ADDRESSID.
[EL Config]: 2010-06-09
15:59:37.069--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d addressLine1] is being defaulted to: ADDRESSLINE1.
[EL Config]: 2010-06-09
15:59:37.073--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d country] is being defaulted to: COUNTRY.
[EL Config]: 2010-06-09
15:59:37.076--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
alias name for the entity cla
ss [class tn.com.bitaka.usersmanager.model.AppUser] is being defaulted
to: AppUser.
[EL Config]: 2010-06-09
15:59:37.078--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
table name for entity [class
tn.com.bitaka.usersmanager.model.AppUser] is being defaulted to: APPUSER.
[EL Config]: 2010-06-09
15:59:37.082--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d userName] is being defaulted to: USERNAME.
[EL Config]: 2010-06-09
15:59:37.084--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d password] is being defaulted to: PASSWORD.
[EL Config]: 2010-06-09
15:59:37.086--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d fax] is being defaulted to: FAX.
[EL Config]: 2010-06-09
15:59:37.09--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [field
 phoneNumber] is being defaulted to: PHONENUMBER.
[EL Config]: 2010-06-09
15:59:37.092--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d userFirstName] is being defaulted to: USERFIRSTNAME.
[EL Config]: 2010-06-09
15:59:37.095--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d userLastName] is being defaulted to: USERLASTNAME.
[EL Config]: 2010-06-09
15:59:37.097--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [fiel
d userMiddleName] is being defaulted to: USERMIDDLENAME.
[EL Config]: 2010-06-09
15:59:37.1--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
column name for element [field
mobileNumber] is being defaulted to: MOBILENUMBER.
[EL Config]: 2010-06-09
15:59:37.139--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--The
primary key column name for t
he mapping element [field address] is being defaulted to: USERNAME.
[EL Info]: 2010-06-09
15:59:37.164--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--EclipseLink,
version: Eclipse Persi
stence Services - 2.0.2.v20100323-r6872
[EL Fine]: 2010-06-09
15:59:37.253--Thread(Thread[Thread-17,5,main])--Detected Vendor
platform: org.eclipse.persistence.platform.d
atabase.PostgreSQLPlatform
[EL Config]: 2010-06-09
15:59:37.269--ServerSession(22672368)--Connection(25015904)--Thread(Thread[Thread-17,5,main])--connecting(

DatabaseLogin(
        platform=>PostgreSQLPlatform
        user name=> "mb-bh"
        datasource URL=> "jdbc:postgresql://localhost:5432/mb-bh"
))
[EL Config]: 2010-06-09
15:59:37.314--ServerSession(22672368)--Connection(5268389)--Thread(Thread[Thread-17,5,main])--Connected:
j
dbc:postgresql://localhost:5432/mb-bh
        User: mb-bh
        Database: PostgreSQL  Version: 8.4.4
        Driver: PostgreSQL Native Driver  Version: PostgreSQL 8.4 JDBC4
(build 701)
[EL Config]: 2010-06-09
15:59:37.315--ServerSession(22672368)--Connection(29237054)--Thread(Thread[Thread-17,5,main])--connecting(

DatabaseLogin(
        platform=>PostgreSQLPlatform
        user name=> "mb-bh"
        datasource URL=> "jdbc:postgresql://localhost:5432/mb-bh"
))
[EL Config]: 2010-06-09
15:59:37.358--ServerSession(22672368)--Connection(16070376)--Thread(Thread[Thread-17,5,main])--Connected:

jdbc:postgresql://localhost:5432/mb-bh
        User: mb-bh
        Database: PostgreSQL  Version: 8.4.4
        Driver: PostgreSQL Native Driver  Version: PostgreSQL 8.4 JDBC4
(build 701)
[EL Info]: 2010-06-09
15:59:37.415--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--mb-bh
login successful
[EL Fine]: 2010-06-09
15:59:37.435--ServerSession(22672368)--Connection(16070376)--Thread(Thread[Thread-17,5,main])--ALTER
TABLE A
DDRESS DROP CONSTRAINT FK_ADDRESS_userName
[EL Fine]: 2010-06-09
15:59:37.503--ServerSession(22672368)--Connection(16070376)--Thread(Thread[Thread-17,5,main])--DROP
TABLE AD
DRESS
[EL Fine]: 2010-06-09
15:59:37.537--ServerSession(22672368)--Connection(16070376)--Thread(Thread[Thread-17,5,main])--CREATE
TABLE
ADDRESS (ADDRESSID  SERIAL NOT NULL, ZIPCODE INTEGER, TOWN VARCHAR(255),
ADDRESSLINE2 VARCHAR(255), ADDRESSLINE1 VARCHAR(255), COU
NTRY VARCHAR(255), userName VARCHAR(255), PRIMARY KEY (ADDRESSID))
[EL Fine]: 2010-06-09
15:59:37.573--ServerSession(22672368)--Connection(16070376)--Thread(Thread[Thread-17,5,main])--DROP
TABLE AP
PUSER
[EL Fine]: 2010-06-09
15:59:37.583--ServerSession(22672368)--Connection(16070376)--Thread(Thread[Thread-17,5,main])--CREATE
TABLE
APPUSER (USERNAME VARCHAR(255) NOT NULL, PASSWORD VARCHAR(255), FAX
VARCHAR(255), PHONENUMBER VARCHAR(255), USERFIRSTNAME VARCHAR(
255), USERLASTNAME VARCHAR(255), USERMIDDLENAME VARCHAR(255),
MOBILENUMBER VARCHAR(255), PRIMARY KEY (USERNAME))
[EL Fine]: 2010-06-09
15:59:37.637--ServerSession(22672368)--Connection(16070376)--Thread(Thread[Thread-17,5,main])--ALTER
TABLE A
DDRESS ADD CONSTRAINT FK_ADDRESS_userName FOREIGN KEY (userName)
REFERENCES APPUSER (USERNAME)
[EL Fine]: 2010-06-09
15:59:37.731--ClientSession(17739482)--Connection(16070376)--Thread(Thread[Thread-17,5,main])--INSERT
INTO A
PPUSER (USERNAME, PASSWORD, FAX, PHONENUMBER, USERFIRSTNAME,
USERLASTNAME, USERMIDDLENAME, MOBILENUMBER) VALUES (?, ?, ?, ?, ?, ?,
 ?, ?)
        bind => [daoud, secret, null, null, Daoud, Faleh, AbdelMonem, null]
[EL Fine]: 2010-06-09
15:59:37.739--ClientSession(17739482)--Connection(16070376)--Thread(Thread[Thread-17,5,main])--UPDATE
ADDRES
S SET userName = ? WHERE (ADDRESSID = ?)
        bind => [daoud, 0]
[EL Config]: 2010-06-09
15:59:37.779--ServerSession(22672368)--Connection(5268389)--Thread(Thread[Thread-17,5,main])--disconnect

[EL Info]: 2010-06-09
15:59:37.78--ServerSession(22672368)--Thread(Thread[Thread-17,5,main])--mb-bh
logout successful
[EL Config]: 2010-06-09
15:59:37.782--ServerSession(22672368)--Connection(25015904)--Thread(Thread[Thread-17,5,main])--disconnect

[EL Config]: 2010-06-09
15:59:37.785--ServerSession(22672368)--Connection(16070376)--Thread(Thread[Thread-17,5,main])--disconnect

 
karaf@root>


With best regards,
Daoud AbdelMonem Faleh.


Back to the top