wood burning stoves 2.0*
The moose likes JDBC and the fly likes Can only return type Iterable from DataStore Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can only return type Iterable from DataStore " Watch "Can only return type Iterable from DataStore " New topic
Author

Can only return type Iterable from DataStore

Johnny Donovan
Greenhorn

Joined: Mar 23, 2011
Posts: 6

Hi Guys,

Im trying to help a friend out. He received a project from college an we struggling to understand the one problem constraint.

Its says - The provided DataStore is not optimally organized.
• It can only return iterables (See java.lang.Iterable<T>) of each object type.

We really dont understand what they mean, as far as i know a DataStore may only return type ResultSet?

Thanks in advance
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

Jonathan, Welcome to the Ranch!

Can you give us the exact message you are getting?


OCUP UML fundamental and ITIL foundation
youtube channel
Johnny Donovan
Greenhorn

Joined: Mar 23, 2011
Posts: 6

Hi Jan, thanks for the welcome

This isnt an error message or anything. In the description of what he will have to do for the project it has a few problem constraints.
The one constraint says that the DataStore he has to use can only return Iterables of each object .

I have pasted a short snippet from his project desciption below:

Hint 1:
When a Card Processor (the class you are writing) is created it is linked to a DataStore. You can access this data store by calling the method getDataStore().
Initially a DataStore it is empty. You can add Customer, Account and Card objects to it one-by-one to do some testing.
When your Card processor is tested by running the Transaction Processor the DataStore will be filled with random data before your Card Processor is initialized.

Hint 2:
The provided DataStore is not optimally organized.
• It can only return iterables (See java.lang.Iterable<T>) of each object type.
• Customer objects do not have any reference to the cards/accounts that are linked to them.

Designing new internal data structures may make queries against the data easier.
See ACardProcessor.init().

Hint 3:
The relationship between the objects in the problem domain is shown below. Note that a Card is uniquely identified by a combination of the card number and expiry date and an account by the account number and account type.


Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

Johnothan Routledge wrote:We really dont understand what they mean, as far as i know a DataStore may only return type ResultSet?

If the DataStore is a provided class, then presumably it can return whatever the writer intended it to return. Why would it be restricted to only returning ResultSets?

It sounds to me like what you need to do is to extract the data from the DataStore (using the interface provided) and store it in your own data structure designed to make whatever searches you have to make easy. Exactly what these data structures are depends on what the expected queries are. For instance, if you needed to search for customers by name, then storing them in a map with the names as a key would make searching easy.
Johnny Donovan
Greenhorn

Joined: Mar 23, 2011
Posts: 6

Matthew Brown wrote:
Johnothan Routledge wrote:We really dont understand what they mean, as far as i know a DataStore may only return type ResultSet?

If the DataStore is a provided class, then presumably it can return whatever the writer intended it to return. Why would it be restricted to only returning ResultSets?

It sounds to me like what you need to do is to extract the data from the DataStore (using the interface provided) and store it in your own data structure designed to make whatever searches you have to make easy. Exactly what these data structures are depends on what the expected queries are. For instance, if you needed to search for customers by name, then storing them in a map with the names as a key would make searching easy.


I see. We thought, when they said design a new internal data structure to make queries easier, that it meant we should add a CustomerID to all the tables so that references to each table could be made.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can only return type Iterable from DataStore
 
Similar Threads
arrayList
Serialized object is not tranfering data between client and server
is JDO for RDBMS only or does it work with other types of datastorage, too?
Array Declaration doubt
How do actions queue requests?