Server error when sorting generated entity with field name with underscore - jhipster

I am getting error.internalServerError when sorting generated entity in generated table view. It leads to error only in case of fields with database names with underscore. For example project_owner.
In my console I am getting this:
GET http://localhost:9000/api/projects?cacheBuster=1489187431846&page=0&size=20&sort=image_logo_url,asc&sort=id 500 (Internal Server Error)
Is it a bug, or only my local problem?! Thanks.

The problem is in wrong parsing. See this URL for more information:
https://jira.spring.io/browse/DATACMNS-816
I thought, that when I generate field with name project_owner, it will be stored as project_owner, but entity name will be camelCase -> projectOwner.
So If you have the same issue, check your entity names and refactor them to camelCase syntax.

Related

Remove collection from model RacerJS?

This is my client Side code:
model.remove('agent',{'text':'online'});
I cant able to remove collection from model,Its shows following error in console
Error: remove must be performed under a collection and document id. Invalid path: agent
From the documentation, it looks like 'path' should be the collectionname.id. In this case, maybe I suppose it should be 'agent.id'.
This blog refers that the path should be in the format collection.documentId.document.
http://blog.derbyjs.com/2012/04/13/derby-v0-dot-3-0/

Spelling error issue in routes while scaffolding Compound js

I'm new with node and compound. While i tried to scaffold
compound g crud leaveApplication leave_code:string description:string applicable:string carry_forward:boolean limit_type:boolean lop:boolean od:boolean co:boolean leave_revision:boolean active:boolean
I was getting some errors, then i tried
compound g crud leave code:string description:string applicable:string cForward:boolean limit:boolean lop:boolean od:boolean co:boolean leave_revision:boolean active:boolean
But the error now occurred was in the name of routes
leaves GET /leaves.:format? leaves#index
leaves POST /leaves.:format? leaves#create
new_leafe GET /leaves/new.:format? leaves#new
edit_leafe GET /leaves/:id/edit.:format? leaves#edit
leafe DELETE /leaves/:id.:format? leaves#destroy
leafe PUT /leaves/:id.:format? leaves#update
leafe GET /leaves/:id.:format? leaves#show
These were the routes i was getting.
Why is that so?
it looks like compound is turning your model name into plural (=leaves) and then, instead of using your provided singular name, turning this plural name back, resulting in "leaf".
Does this make any sense? ;-) Or did I get you question wrong?
If you could provide the "some errors" and the full error message, it would be easier to help ;)
Btw, I just experienced that using camel case for models doesn't seem to be a good idea with compound.js.
It's mangeling the camelcase in some places (e.g. inside the controllers), but in others not (schema.js) creating a application with some errors...

ServiceStack OrmLite casing a bug

Doing a simple
db.Dictionary("select Id, Name from \"Product\"");
results in an exception
"column "id" does not exists"
The correct field name is "Id" - seems as if the Postgres in OrmLite does something to the "Id" field. Tried with some random field names with mixed casing and they also ended up in exceptions where the fields where displayed in all lower case.
Can this be achieved somehow or is this an error in OrmLite?
Is this also an issue in db.List, db.Lookup etc?
Have you tried putting the column in quotes to preserve the case?
db.Dictionary("select \"Id\", Name from \"Product\"");
There is a unit test example here https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/src/ServiceStack.OrmLite.PostgreSQL.Tests/OrmLiteSelectTests.cs#L195

Sharepoint Business Data List Behavior

This is a multi faceted question, but any help is appreciated
Background:
I have a Application Definition with 6 entities using SSO
The database back end is Firebird through ODBC
All the data is coming from stored procedures
Questions:
1 While trying to implement one or any of the entities from the BDC in a Business Data List web part I get the following error: "An error occurred while retrieving data from . Administrators, see the server log for more information." It only happens when I have fields that are null, in this instance a field that was declared as a string.
2.When I check the logs, it's a System.OverFlowException.
3.If I change it so the output from the procedure is a blank string, I suddenly get "The title property of entity is set to an invalid value"
4.The error from the logs after changing to a blank string is "Exception handed to HandleXslException.HandleException System.ArgumentException: '.', hexadecimal value 0x00, is an invalid character"
What gives? It worked last night without issue until a record appeared that had a null value in one of the string field. Now, even replacing the null value with something generic is still giving me the title property invalid error.
Most puzzling: If I change the query so that the rows with what would be a null or blank string aren't in the query, the error goes away. But, if I add them back and replace the null string with anything, the error comes back. What the !##$? How does it know I've replaced a null value with something else before the records are returned to the XmlReader?
I've run into this exact scenario and it brought back some angry/confused moments. As you said in your comment:
I set the encoding to be unicode on all varchar and char outputs and it fixed it. The lack of encoding caused there to be null characters (not a null record, but one null character) for that column and Sharepoint could not parse the field. Changed the encoding, and everything works.
It took me a couple days of swearing at the computer before we took it down to the metal and discovered the unicode issue. I don't even know when it changed but we realized the same thing and all was right with the world again.

Subsonic BatchQuery.Queue causing 'Can't decide which property to consider the key...' exception

I'm just getting started with Subsonic 3.0 ActiveRecord and am trying to implement a batch query like the one in the SubSonic docs. I'm using a batch so I can query a User and a list of the users Orders in one shot.
When I call the BatchQuery.Queue() method, adding my "select user" query, SubSonic throws the following exception:
System.InvalidOperationException : Can't decide which property to consider the Key - you can create one called 'ID' or mark one with SubSonicPrimaryKey attribute
The code is as follows:
var db = new MyDB();
var userQuery = from u in db.Users //gets user by uid
where u.uid == 1
select u;
var provider = ProviderFactory.GetProvider();
var batch = new BatchQuery(provider);
batch.Queue(userQuery); //exception here
//create and add "select users orders" query here...
First things first - Why this error? My SubSonic Users object knows it's PK. "uid" is the PK in the database and the generated code reflects this. And I thought SubSonicPrimaryKey attribute was for the SimpleRepository? Is this way of batching not for ActiveRecord?
I could ask a number of other questions, but I'll leave it at that. If anyone can help me figure out what is going on and how to issue 2 batched queries I'd be grateful!
Edit - after further investigation
I ran through the source code with the debugger. Adam is correct - the ToSchemaTable() method in Objects.cs is apparently building out my schema and failing to find a PK. At the very end, it tries to find a column property named "ID" and flags this as the PK, otherwise it throws the exception. I added a check for "UID" and this works!
Still... I'm confused. I'm admittedly a bit lost after peeling back layer after layer of the source, but it seems like this portion of code is trying to build up a schema for my table and completely ignoring my generated User class - which quite nicely identifies which column/property is the PK! It doesn't seem quite right that I'd be required to name all keys "ID" w/ ActiveRecord.
I think the answer you're looking for is that this is a really stupid bug on my part. I'm hoping to push another build next week and if you could put this on the issue list I'd really appreciate it. My apologies...
SubSonic expects your primary key to be called Id so it's getting confused. SubSonicPrimaryKey is for simple repository but I assume where that exception is being thrown is shared between the different templates. If you rename your PK to Id or id or ID your query will work.

Resources