-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: joinTable across multiple schemas
PostPosted: Wed Dec 03, 2014 8:38 pm 
Newbie

Joined: Wed Dec 03, 2014 7:28 pm
Posts: 2
Hi

I'm trying to do a join across multiple schemas

The two schemas are called A and B. A contains table1, and table2. B contains table3.

A.table1 contains a aId - where aId = aId in table2
A.table2 contains a aId and a bId
B.table3 contains cId
where A.table2.BId = B.table3.CId

A.table1 uses A.table2 to pull data List from B.table3
-SO-
A.table1--aId-->A.table2--bId--> B.table3(cID) - return table3 data as List

Here is my method in hibernate.

private List<Table3Data> table3Data;

@OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
@IndexColumn(name = "cId")
@JoinTable(name = "table2", catalog="A",
joinColumns = { @JoinColumn(name = "aId", nullable=false, updatable=false, insertable=false) },
inverseJoinColumns = { @JoinColumn( name = "bId", nullable=false, updatable=false, insertable=false) })
public List<Table3Data> getTable3Data() {
return table3Data;
}


I get a PersistentList back but I cant tell if I am getting the correct data back, or extract the table3Data from the PersistentList. If i change the fetch type to EAGER then i get the following error.

ERROR: column table3Datas2_.cid does not exist


UPDATE: I learned that i was trying to save null data and that was throwing an error but was not being logged on the server. This is with a GWT project. Add the servlet to your project and replace this servlet twith the requestFactoryServlet.


public class LoggingRequestFactoryServlet extends RequestFactoryServlet {

private static final long serialVersionUID = -4217765543365987901L;

private static class LoggingExceptionHandler extends DefaultExceptionHandler {

private static final Logger LOGGER = Logger.getLogger(LoggingExceptionHandler.class );

@Override
public ServerFailure createServerFailure(Throwable throwable ) {
LOGGER.error("Server Error", throwable );
return super.createServerFailure(throwable );
}
}

public LoggingRequestFactoryServlet() {
super(new LoggingExceptionHandler());
}
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.